Webpack behavior with loading CSS pages without styling then flashing

Because I am using Webpack to also bundle my css and that my script tag is at the bottom of my HTML, on initial page load, I get the page content without any styling.

Then the style suddenly pops up when the script kicks.

Webpack is very useful to help bundle CSS, but this behavior is rather awkward and not very acceptable.

What are the common ways to fix this problem?

+3


source to share


1 answer


You can use extract-text-webpack-plugin to split the css into your own files. This way you can add tags <link>

yourself to the pages where you want their styles to load before the JS loads. See style sheets as a separate package .



+2


source







All Articles