Skip to content
This repository has been archived by the owner on Nov 16, 2021. It is now read-only.

Bundle size with ng-inline-svg #92

Closed
moniuch opened this issue Oct 24, 2018 · 5 comments
Closed

Bundle size with ng-inline-svg #92

moniuch opened this issue Oct 24, 2018 · 5 comments

Comments

@moniuch
Copy link

moniuch commented Oct 24, 2018

This module (functionally) works just great. Solves most of my project's SVG needs. The only problem - but huge enough to make itself almost unusable - is bundle size.

On a fresh ng new myapp application, with ng-inline-svg installed and [inlineSVG] applied to just one div, the bundle size after ng build --prod --aot --build-optimizer jumps from 170kb to 400+kb.

Is there anything you can do about it?

@arkon
Copy link
Owner

arkon commented Oct 26, 2018

I don't have much knowledge about AOT optimizations (I stopped actively using Angular before AOT was really a thing), so I'd definitely be grateful for any pointers here.

@juliusstoerrle
Copy link

juliusstoerrle commented Nov 12, 2018

Just checked in my app with webpack-bundle-analyzer and for ng-inline-svg/lib it lists less than 3kb gziped.
In my code I'm only importing InlineSVGModule.

My app is not a fresh new application. maybe @moniuch you can use webpack-bundle-analyzer and check what takes the space in you build?

@DennisNeuendorfNetlight
Copy link
Contributor

I agree with @juliusstoerrle it is very very small, when importing only the InlineSVGModule.

image

@arkon
Copy link
Owner

arkon commented Nov 14, 2018

Very interesting, thanks for the insight folks. @moniuch Have you been able to deep dive into your bundle size?

@intellix
Copy link

intellix commented Nov 20, 2018

One improvement here would be using the new ng6 @Injectable({ providedIn: 'root' }) so those services can be tree shaken if unused.

Then you can also deprecate/remove forRoot on the module too

@arkon arkon closed this as completed Apr 7, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants