extract-text-webpack-plugin" loader is used without the corresponding plugin 打包報錯

這個問題之前困擾我好久 在項目發佈的是需要打包 剛開始打包沒問題  突然今天出錯了  網上的答案千奇百怪  話不多說 直接上代碼 


剛開始 以爲是 插件版本問題 有一些確實是版本問題 


後面經過測試 和版本無關  不管是之前還是之後的版本 都沒關係

在build 下面的webpack.prod.conf.js 裏面 只需要修改如下配置

// extract css into its own file
new ExtractTextPlugin({
// filename: utils.assetsPath('css/[name].[contenthash].css'),//原始的配置
filename: utils.assetsPath('[name]/styles.[contenthash].css'),//修改過的地方
// Setting the following option to `false` will not extract CSS from codesplit chunks.
// Their CSS will instead be inserted dynamically with style-loader when the codesplit chunk has been loaded by webpack.
// It's currently set to `true` because we are seeing that sourcemaps are included in the codesplit bundle as well when it's `false`,
// increasing file size: https://github.com/vuejs-templates/webpack/issues/1110
allChunks: true,
}),
結果 就沒問題了


具體原因不是很清楚 通過在github論壇上 得知好像是插件補丁的問題  有興趣的可以研究一下  

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章