-
-
Notifications
You must be signed in to change notification settings - Fork 78
Open
Labels
Description
Reproduction link or steps
Problem Description
When using unbundle: true
configuration in tsdown
, exported type declarations containing direct typeof import('./module')
expressions cause the build to generate an unexpected dist/_virtual/rolldown_runtime.js
file. This virtual runtime file appears to be unnecessary since the typeof import()
expression is purely a type operation that should be erased during compilation.
Steps to Reproduce
- Create a
tsdown.config.ts
file with:export default { dts: true, unbundle: true };
- Create a worker module:
// worker.ts export function workerMethod() {}
- Create a main file with an exported type:
// index.ts export type WorkerMethodNames = keyof typeof import('./worker');
- Run the build:
tsdown build
- Observe the output directory contains
dist/_virtual/rolldown_runtime.js
Live Reproduction:
https://stackblitz.com/edit/tsdown?file=package.json
What is expected?
Not generate any virtual runtime files for pure type expressions
What is actually happening?
Generates dist/_virtual/rolldook_runtime.js
containing runtime code
Any additional comments?
No response
tomsansome