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

Question - Bundle size #1400

Closed
olaf89 opened this issue Jan 22, 2017 · 4 comments
Closed

Question - Bundle size #1400

olaf89 opened this issue Jan 22, 2017 · 4 comments
Labels

Comments

@olaf89
Copy link

olaf89 commented Jan 22, 2017

Hello, im currently investigating my bundle size using aot and prod build version. I noticed that for example using one module from ng2-bootstrap causes all modules from that library to be bundled. I would like to have in my bundle only those modules which im using. Is this expected ? Is that something ng2-bootstrap library should improve on? or should i investigate more advanced tools for tree shaking?

@joshwiens
Copy link
Contributor

It's not quite that simple but you have two options, split or shake.

For tree shaking, anything that isn't commonjs will benefit from the tree shaking that's in master currently. I don't use bootstrap, first thing I would check is that what you are trying to shake out is a ES2015 module and not commonjs. If it's commonjs, you would have to take it up with them or use another component framework.

If it's ES2015 and not being properly shaken, we will have to look at your setup.

@olaf89
Copy link
Author

olaf89 commented Jan 22, 2017

I used clean clone of latest version of this starter and just added alert module from ng2-bootstrap.
As a result whole liblary was added to bundle.
image
I think this is their config: ("module": "commonjs")
https://github.com/valor-software/ng2-bootstrap/blob/development/src/tsconfig.json
I understand that is not related to any configuration in starter, Thanks so much for help! Please close.

@evgd
Copy link

evgd commented Jan 24, 2017

will it "shake" correctly with the latest changes?
valor-software/ngx-bootstrap@2d74fc3
-"module": "commonjs",
+"module": "es2015",

@olaf89
Copy link
Author

olaf89 commented Jan 24, 2017

It does not,
issue:
valor-software/ngx-bootstrap#1538

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

No branches or pull requests

3 participants