Reproduction link or steps
Recently as developers we have got to work with top level await in our code and we use rolldown as a bundler.
And here is the problem that came out.
When some exports in modules are declared with wildcards (export * from)
that disables rolldown from tracking types and at some point await is getting lost which leads to broken code when bundle generated.
I have worked around it by creating a plugin which replaces wildcard exports to named ones and that seemed to work but I would like to work without additional complications.
Here is the repo with MRE.
https://github.com/damask/rolldown-export-wildcard-top-level-await
Thank you!
What is expected?
Wildcard exports are expected to work as named ones.
When I build the named case it works fine and I see in the bundle
//#region src/reexport-named.ts var init_reexport_named = __esm({ "src/reexport-named.ts": (async () => { await init_async_nested_module(); }) });
What is actually happening?
When we build export * case
await is lost
code is broken
//#region src/async-module.ts var init_async_module = __esm({ "src/async-module.ts": (async () => { init_async_nested_module(); // THE PROBLEM }) });
System Info
"rolldown": "1.0.0-beta.35"
find details in repo I created
Any additional comments?
No response
Reproduction link or steps
Recently as developers we have got to work with top level await in our code and we use rolldown as a bundler.
And here is the problem that came out.
When some exports in modules are declared with wildcards (export * from)
that disables rolldown from tracking types and at some point await is getting lost which leads to broken code when bundle generated.
I have worked around it by creating a plugin which replaces wildcard exports to named ones and that seemed to work but I would like to work without additional complications.
Here is the repo with MRE.
https://github.com/damask/rolldown-export-wildcard-top-level-await
Thank you!
What is expected?
Wildcard exports are expected to work as named ones.
When I build the named case it works fine and I see in the bundle
//#region src/reexport-named.ts var init_reexport_named = __esm({ "src/reexport-named.ts": (async () => { await init_async_nested_module(); }) });What is actually happening?
When we build export * case
await is lost
code is broken
//#region src/async-module.ts var init_async_module = __esm({ "src/async-module.ts": (async () => { init_async_nested_module(); // THE PROBLEM }) });System Info
Any additional comments?
No response