rollup / rollup/rollup

Tree Shaking seems to be malfunctioning, resulting in unexpected generation of shared packages

Open
#5,788 1 comment 0 reactions 0 assignees View on GitHub

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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.