I am trying to get css requires to work in webpack using the ExtractTextPlugin but with no success
I want a separate css file rather than inlining any css.
Using css-loader
and style-loader
together first parse your CSS, then turn it into style nodes, which can be imported in Webpack just like code. I don't understand why you'd want this artificial relationship built between your JavaScript and your CSS.
The above approach emits CSS again in the end. Why put your code through a round trip like that? Use raw-loader and add your main CSS file to your entry points. You lose any error-checking that css-loader
performs, but your compilation happens much faster. But if you're using something like sass-loader
, you'll still get all the error checking.