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


 

轉自:https://blog.csdn.net/hailangtuteng/article/details/81015413

 

 

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

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

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

在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,
}),

結果 就沒問題了


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM