Hi folks,
I’m working on a CMS like system where you pick from a list of templates to render on each page. Some of these templates are quite large and so I’m using dynamic imports to code split. The only thing I don’t get is how to import the styles for each module. The templates are currently provided by local packages since the code is shared between many apps.
I’d prefer not to have to include the styles for all possible templates in the bundle. And I’m not sure what happens to all the styles injected to the page when you import styles from javascript, especially after navigating around and loading a bunch of templates.
What is the best way to dynamically import styles for large templates / modules?