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 can reproduce this issue when running this plugin on its own. Other plugins, such as node-resolve are known to cause issues.
I am running this plugin on .d.ts files generated by TypeScript. The plugin can consume .ts and even .js files (with allowJs: true), but this is known to cause issues.
This issue is not related to rolling up @types. The plugin ignores these by default, unless respectExternal is set. @types can contain hand-crafted code which is known to cause issues.
Issue Description
When creating files using the tsconfig setting isolatedModules: true, type exports must explicitly use export type { ... } or export { type ... } (TS1205 is the relevant error code). tsc does this correctly, e.g. the following code snippet:
typeTest={challenge: string;}export{typeTest};
is reproduced as-is in the corresponding .d.ts file.
However, rollup-plugin-dts elides the type part of the export, leading to the mentioned error.
A minimal reproduction can be found here: https://github.com/mithodin/dts-bundle-isolation-repro
Compile using npm install && npm run build and check the file /dist/bundle.d.ts. For comparison with tsc, run npx tsc and check /out/gameLibrary.d.ts.
It should be mentioned that this causes issues for anyone using a library bundled using rollup-plugin-dts, who wants to enable isolatedModules.
The text was updated successfully, but these errors were encountered:
I was trying to bulk-close all of the old issues in the repo, as I have moved the project into maintenance mode: #277 Too bad github does not allow bulk-close-with-comment.
That being said, I will most likely not work on resolving this issue, but would very much appreciate a PR.
Solving this would likely involve changing the "post processing" code to split type-only exports from normal exports.
Checklist
Other plugins, such as
node-resolve
are known to cause issues..d.ts
files generated by TypeScript.The plugin can consume
.ts
and even.js
files (withallowJs: true
), but this is known to cause issues.@types
.The plugin ignores these by default, unless
respectExternal
is set.@types
can contain hand-crafted code which is known to cause issues.Issue Description
When creating files using the tsconfig setting
isolatedModules: true
, type exports must explicitly useexport type { ... }
orexport { type ... }
(TS1205 is the relevant error code).tsc
does this correctly, e.g. the following code snippet:is reproduced as-is in the corresponding .d.ts file.
However, rollup-plugin-dts elides the
type
part of the export, leading to the mentioned error.A minimal reproduction can be found here: https://github.com/mithodin/dts-bundle-isolation-repro
Compile using
npm install && npm run build
and check the file/dist/bundle.d.ts
. For comparison with tsc, runnpx tsc
and check/out/gameLibrary.d.ts
.It should be mentioned that this causes issues for anyone using a library bundled using rollup-plugin-dts, who wants to enable isolatedModules.
The text was updated successfully, but these errors were encountered: