Getting css output using webpack ExtractTextPlugin

后端 未结 4 1380
轻奢々
轻奢々 2020-12-24 10:43

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.

4条回答
  •  感情败类
    2020-12-24 11:29

    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.

提交回复
热议问题