Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

angular build size with sass is huge

Tags:

sass

angular

So, I'm working on big app and all components have their own sass file style (we use ViewEncapsulation.Native) but I build npm run build --stats-json --prod --aot and check the stats with https://chrisbateman.github.io/webpack-visualizer/ I get this

enter image description here

All those big orange blocs on the right are sass.shim.ngstyle.ts files and each one is like 195k !

like image 442
Rachid O Avatar asked Jun 13 '17 15:06

Rachid O


1 Answers

so after some investigation the problem was that every component was importing the _mixins.sass but the mixins was also importing bootstrap-custom.sass file that was quite large in size.

the solution was to import _bootstrap-custom.sass from the _main.sass and import bootstrap-custom-variables.sass from mixins.sass file because some custom mixins needed those variables.

like image 152
Rachid O Avatar answered Nov 01 '22 07:11

Rachid O