You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying to use rollupTypes: true to roll up my type declarations. However, the main export is missing from my bundle.
What seems to be happening is that the plugin generates an index.d.ts file that only contains an export * statement for my entry point, so it's not reexporting the default export. The reason seems to be here where it calls hasExportDefault. That checks whether the file contains a node of type SyntaxKind.ExportAssignment (277) or SyntaxKind.ExportDeclaration (278) with the export name default. This seems to work for a statement like export default test;, but my statement export default class Test { } has the node type SyntaxKind.ClassDeclaration (263).
As a workaround, I was able to declare as class Test { } and then exporting it in a separate statement as export default Test;.
Describe the bug
Apologies if I'm misunderstanding something.
I'm trying to use
rollupTypes: true
to roll up my type declarations. However, the main export is missing from my bundle.What seems to be happening is that the plugin generates an
index.d.ts
file that only contains anexport *
statement for my entry point, so it's not reexporting the default export. The reason seems to be here where it calls hasExportDefault. That checks whether the file contains a node of typeSyntaxKind.ExportAssignment
(277) orSyntaxKind.ExportDeclaration
(278) with the export namedefault
. This seems to work for a statement likeexport default test;
, but my statementexport default class Test { }
has the node typeSyntaxKind.ClassDeclaration
(263).As a workaround, I was able to declare as
class Test { }
and then exporting it in a separate statement asexport default Test;
.Reproduction
https://stackblitz.com/edit/vitejs-vite-hspghz?file=vite.config.js
Steps to reproduce
Run
npm run build
and inspect the generated bundle indist/test.d.mts.d.ts
.System Info
Validations
The text was updated successfully, but these errors were encountered: