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
Huge Bundle Size when import every module #4686
Comments
Hi @alexnoise79 OK, but the point of |
Hi @jnizet yes i l know, but is the only way to see all the module names in any case even with optimization:false the bundle still contains all the modules, and this is wrong. i updated the description, thanks |
It's not wrong. The optimization is precisely designed to tree-shake the bundles and remove the unused parts. |
|
That is part of the unoptimized bundle. If you turn optimization on, it will be removed. That's what optimization is for. |
you are right, i checked the minified does not contain all, even if in some scenario i have "ngbDropdown" that have not been imported in other modules. there is no way to tree-shake the unoptimized bundle? |
This is because the library has only a single entrypoint. For libraries ng-packagr will always produce chunks per entrypoint, and so loading a single module from this entrypoint drags the entire entrypoint into the bundle. Some time ago I asked about this on StackOverflow, but still investigated everything myself. The library should be structured like this with entrypoints next to the src folder |
Bug description:
dist bundle includes every module when a single module in included.
is present in the main-[hash].js when importing a single module in a standalone component.
Minimal reproduction
ng add @ng-bootstrap/ng-bootstrap
app.component.ts
app.component.html
ng build your-project
Versions of Angular, ng-bootstrap and Bootstrap:
Angular: 17.2
ng-bootstrap: 16.0.0
Bootstrap: 5.3.2
The text was updated successfully, but these errors were encountered: