`/*#__PURE__*/` annotation ineffective for tree-shaking top-level `await import().then(...)` expressions
Open
Nobody has claimed this yet.
t¹ 🐞 bug
t⁸ ⋅ triage
- Dominant language
- JavaScript
- Stars
- 26.3k
- Forks
- 1.8k
- Avg merge
- 2d 11h
- Merged PRs (30d)
- 20
Description
Rollup Version
4.40.2
Operating System (or Browser)
Node Version (if applicable)
No response
Link To Reproduction
Expected Behaviour
/*#__PURE__*/await import is pure function call
const a = await import('./all-DnWgraJt.js').then(({native_a,shim_a})=>native_a?native_a:shim_a);
// await import('./all-DnWgraJt.js').then(({native_b,shim_b})=>native_b?native_b:shim_b);
console.log(a);
Actual Behaviour
const a = await import('./all-DnWgraJt.js').then(({native_a,shim_a})=>native_a?native_a:shim_a);
await import('./all-DnWgraJt.js').then(({native_b,shim_b})=>native_b?native_b:shim_b); // should be removed
console.log(a);
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the linked Rollup 4.40.2 reproduction and compare the generated output with the expected tree-shaking behavior for top-level await import().then(...) expressions. Trace the tree-shaking handling for the two annotated expressions, then verify that the unused second expression is removed while the used first expression remains.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- build-system
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100