Tree Shaking seems to be malfunctioning, resulting in unexpected generation of shared packages
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 26.3k
- Forks
- 1.8k
- Avg merge
- 2d 11h
- Merged PRs (30d)
- 20
Description
this is demo:
//main.js
import {Cube} from './otherEntry.js';
console.log(Cube.cube(5));
//otherEntry.js
export * as Cube from './cube.js';
//cube.js
export function cube(x) {
return (x) * x;
}
export function square(x) {
return (x) * 2*x;
}
I expect rollup to generate two files(main.js ,otherEntry.js).But in reality, three files will be generated(main.js ,otherEntry.js,otherEntry-9fb58ca5.js).It is evident that otherEntry.js has generated a shared package.
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 by reproducing the behavior from the main.js, otherEntry.js, and cube.js demo with Rollup, then inspect the generated chunks and tree-shaking behavior. Done means the example generates only main.js and otherEntry.js while preserving the imported Cube.cube call.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- build-system, tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100