rollup-plugin-dts
rollup-plugin-dts copied to clipboard
error d.ts
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
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?
@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()],
},
];