webpack warning:chunk fail [mini-css-extract-plugin]
此警告为css加载顺序不一致的提示,原因是其它组件引入错误提示中所示的两个组件时,引用顺序不一致所导致的。如果你使用 <style scope>...</style>
,可忽略此警告,如果要关闭此警告,将mini-css-extract-plugin插件的ignoreOrder项设置为true
错误信息:
1 2 3 4 5 6 7 8 |
chunk fail [mini-css-extract-plugin] Conflicting order. Following module has been added: * css ./node_modules/@vue/cli-service/node_modules/css-loader/dist/cjs.js??ref--11-oneOf-1-1!./node_modules/vue-loader/lib/loaders/stylePostLoader.js!./node_modules/@vue/cli-service/node_modules/postcss-loader/src??ref--11-oneOf-1-2!./node_modules/less-loader/dist/cjs.js??ref--11-oneOf-1-3!./node_modules/cache-loader/dist/cjs.js??ref--1-0!./node_modules/vue-loader/lib??vue-loader-options!./src/views//BaseCard.vue?vue&type=style&index=0&id=ecf9cf3a&lang=less&scoped=true& despite it was not able to fulfill desired ordering with these modules: * css ./node_modules/@vue/cli-service/node_modules/css-loader/dist/cjs.js??ref--11-oneOf-1-1!./node_modules/vue-loader/lib/loaders/stylePostLoader.js!./node_modules/@vue/cli-service/node_modules/postcss-loader/src??ref--11-oneOf-1-2!./node_modules/less-loader/dist/cjs.js??ref--11-oneOf-1-3!./node_modules/cache-loader/dist/cjs.js??ref--1-0!./node_modules/vue-loader/lib??vue-loader-options!./src/views/FilterBar.vue?vue&type=style&index=0&id=f236d9ee&lang=less&scoped=true& - couldn't fulfill desired order of chunk group(s) , - while fulfilling desired order of chunk group(s) , , , , , , , , , , , , , , , , , , , , , , , , , |
解决方法:
webpack.config.js
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
const MiniCssExtractPlugin = require("mini-css-extract-plugin"); module.exports = { plugins: [ new MiniCssExtractPlugin({ ignoreOrder: true, }), ], module: { rules: [ { test: /\.css$/i, use: [MiniCssExtractPlugin.loader, "css-loader"], }, ], }, }; |
vue.config.js
1 2 3 4 5 6 7 8 |
const vueConfig = { ... css: { extract: { ignoreOrder: true } } } |
参考链接:
https://webpack.docschina.org/plugins/mini-css-extract-plugin#remove-order-warnings
文章评论 暂无评论
暂无评论