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

Reduce bundle size with webpack and angular #4326

Closed
tom94zoe opened this issue Nov 8, 2018 · 4 comments
Closed

Reduce bundle size with webpack and angular #4326

tom94zoe opened this issue Nov 8, 2018 · 4 comments

Comments

@tom94zoe
Copy link

tom94zoe commented Nov 8, 2018

Hi

I am using rxjs. 6.3.3 within an angular 6 application. Caused by some performance issues, I am currently reducing the size of our bundles (webpack v4).
The size of the bundle shrinks after i removed all"rxjs/interal/operators" imports.

Unfortunately my threeshaked bundle still contains an 'internal' module, as you can see in the screenshot below.
Are there possibilites to remove the 'internal' module?

image

Thanks in advance

@martinsik
Copy link
Contributor

@tom94zoe
Copy link
Author

Yes I am using Angular-CLI and tree shaking should be working.

After I removed all "rxjs/interal/operators"-imports the bundle was much smaller because the tree-shaking-process can remove the most "internal"-dependencies.

Are there other imports that should be avoided?

For me, It looks a little bit strange, that zip.js, groupBy.js, Subject.js, etc. are included in the _esm5 bundle and the internal bundle.

@Ristaaf
Copy link

Ristaaf commented Nov 13, 2018

Are you using rxjs-compat? There is a problem there with Observable being imported from internal and not _esm5. #4070.

@tom94zoe
Copy link
Author

tom94zoe commented Nov 13, 2018

No, I am not using rxjs-compat anymore.

Now I have scanned all files again. There was one import from 'rxjs/index' all other where from 'rxjs' directly or 'rxjs/operators'. After removing the index import the file shrinks again from gzipped 36kb to 24kb.

Thank you

@lock lock bot locked as resolved and limited conversation to collaborators Dec 13, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants