Hey everyone, does someone have experience with code splitting in Sage? I’d like to load the minimal amount of CSS/JS where they are not needed and my current JS bundle in dist is around 1.5mb which is not ideal.
Thanks,
Kris
Hey everyone, does someone have experience with code splitting in Sage? I’d like to load the minimal amount of CSS/JS where they are not needed and my current JS bundle in dist is around 1.5mb which is not ideal.
Thanks,
Kris
Code splitting is achieved by using the import
syntax supported in webpack
. You can find more about it here
Whether you require js
or scss
files is a matter of design in your application, but webpack makes it really easy and straightforward
My only advices is, make sure you structure your scss
files in a way that doesn’t duplicate classes. Make sure you have your variables and functions separate, so that you can import them from async bundles without duplication!