Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

splitting with multiple entrypoints does not split dependencies into smaller more optimal chunks #2227

Open
chungwu opened this issue May 5, 2022 · 1 comment

Comments

@chungwu
Copy link

chungwu commented May 5, 2022

I have multiple entrypoints that import from some set of library modules, and I would like to use splitting to spit out "optimal" chunks such that each entrypoint only ends up importing the subset of library modules it needs.

Here's an example with esbuild, where the result is not optimal; each entrypoint (main*.js) ends up importing all the library module code (Comp1 / Comp2), even though each only needs either Comp1 or Comp2.

Rollup does split this more optimally; here's the rollup output.

Is it possible to achieve a result like rollup's with esbuild?

Thanks!

@chungwu
Copy link
Author

chungwu commented May 5, 2022

This makes the biggest difference for packages like antd or react-aria, which has a "mono package" that imports and re-exports from many sub-packages (like the comps.js module in the example). It looks like it is important to avoid using mono-packages like this for now and to import directly from the sub-packages instead.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant