ExtractTextPlugin
In production, it is recommended to extract all your CSS code into a separate file. This is because CSS files need to be included at the beginning of the page so that page styles will be applied to HTML while it is loading. However, since we are bundling CSS together with JavaScript, we are including it at the end of the page. When the page is loading, it will look like a plain document till the CSS files are loaded.
ExtractTextPlugin is used to overcome this problem. It will extract all the CSS files in JS code into separate files with the same name as the JS file it was bundled together with. We can now include that CSS file at the top of our HTML file, which makes the styles be loaded first. As usual, the first step is ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access