Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

error d.ts #286

Open
liuseen-l opened this issue Sep 2, 2023 · 1 comment
Open

error d.ts #286

liuseen-l opened this issue Sep 2, 2023 · 1 comment

Comments

@liuseen-l
Copy link

liuseen-l commented Sep 2, 2023

rollup.config.ts
{
  input: ['./packages/nova/index.ts'],
  output: [
    {
      dir: 'dist/es',
      format: 'esm',
      preserveModules:true,
    },
  ],
  external:['lodash'],
  plugins: [ dts() ]
}

the compoents/index.d.ts is lost
image

the nova/index.ts

export * from '../components'
export * from '../c'

the components/index.ts

export * from './button'
export * from './menu'

and the nova/index.d.ts is not right?
image

@liuseen-l liuseen-l changed the title lose d.ts error d.ts Sep 2, 2023
@aimee-gm
Copy link

@liuseen-l Following the README.md:

While this plugin is fairly complete, it does not support all imaginable use-cases. In particular, the plugin works best with already existing .d.ts files generated by the typescript compiler from idiomatic code.

Working with .ts(x) or even .js(x) (when setting allowJs: true) does work, but is not recommended.

I've got it working by adding this as an additional step in rollup:

export default [
  {
    input: "./src/index.ts",
    plugins: [
      typescript(...), // tsconfig outputs type declarations to `/types`
      ...
    ],
    output: [...],
  },
  {
    input: "./dist/types/index.d.ts",
    output: [{ file: "dist/index.d.ts", format: "es" }],
    plugins: [dts()],
  },
];

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants