Issue
I have a css file in my project which I refer in MANY components with Component's styleUrls property. May this practice increase the bundle size if I refer it in more/new components? Should I put global rules in in app.component.css or in the global css file (styles.css)?
Solution
Yes, by default Angular uses emulated ShadowDom where all the styles will be isolated from each other, so each component will have its own set of styles. Same happened when you are importing big library into your small component - all the imported styles will be included into the bundle.
Also you should know that Angular (ie Webpack under the hood) do NOT run tree shaking for styles.
Answered By - Lonli-Lokli
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.