本文介绍了mini-css-extract-plugin在块chunkName中的警告[mini-css-extract-plugin]之间的冲突顺序:的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

警告在块AccessRights〜Groups〜Navigator中[mini-css-extract-plugin]之间的顺序冲突:

WARNING in chunk AccessRights~Groups~Navigator [mini-css-extract-plugin]Conflicting order between:

  • css ../node_modules/css-loader ?? ref--7-1!../node_modules/postcss-loader/lib!./components/Icon/_circle/Icon_circle.scss
  • css ../node_modules/css-loader ?? ref--7-1!../node_modules/postcss-loader/lib!./components/Counter/Counter.scss
  • css ../node_modules/css-loader ?? ref--7-1!../node_modules/postcss-loader/lib!./components/NavigatorToolbar/NavigatorToolbar.scss

这是什么意思,以及如何解决?预先谢谢您!

"assets-webpack-plugin": "3.9.5",
"autoprefixer": "9.1.0",
"css-loader": "1.0.0",
"file-loader": "1.1.11",
"image-webpack-loader": "4.3.1",
"mini-css-extract-plugin": "0.4.2",
"postcss-advanced-variables": "2.3.3",
"postcss-clearfix": "2.0.1",
"postcss-conditionals": "2.1.0",
"postcss-extend": "1.0.5",
"postcss-functions": "3.0.0",
"postcss-hexrgba": "1.0.1",
"postcss-import": "12.0.0",
"postcss-loader": "2.1.6",
"postcss-media-minmax": "3.0.0",
"postcss-nested": "3.0.0",
"postcss-sassy-mixins": "2.1.0",
"postcss-simple-vars": "4.1.0",
"postcss-size": "2.0.0",
"postcss-urlrewrite": "0.2.2",
"source-map-loader": "0.2.3",
"string-replace-loader": "2.1.1",
"style-loader": "0.22.0",
"url-loader": "1.0.1",
"webpack": "4.16.5",
"webpack-cli": "3.1.0",
"webpack-dev-server": "3.1.5",

推荐答案

问:警告是什么意思?

A:打包CSS模块时会有一些顺序冲突.

A: There are some order conflicts while packaging your CSS modules.

问:是什么原因?

A:插件(mini-css-extract-plugin)尝试生成CSS文件,但是您的代码库对模块有多种可能的排序.从显示的警告来看,您似乎在一个位置的 Counter 之前使用了 Icon ,在以下位置的 Icon 之前使用了 Counter 另一个位置.该插件需要从中生成一个CSS文件,并且无法决定哪个模块的CSS应该放在首位.CSS关心规则顺序,因此当CSS无故更改时,这可能会导致问题.因此,未定义明确的顺序可能会导致构建易碎,这就是为什么它在此处显示警告的原因.

A: The plugin (mini-css-extract-plugin) tries to generate a CSS file but your codebase has multiple possible orderings for your modules. From the warning you showed, it seems you have used Icon before Counter in one location and Counter before Icon in another location. The plugin needs to generate a single CSS file from these and can't decide which module's CSS should be placed first. CSS cares for rule order so this can lead to issue when CSS changes without reason.So not defining a clear order can lead to fragile builds, that's why it displays a warning here.

问:如何解决?

A:对进口商品进行排序以创建一致的订单.如果您不想麻烦自己,可以在这些样式的顺序无关紧要时忽略stats.warningFilter的警告(如Czilla给出的答案所示).

A: Sort your imports to create a consistent order. If you don't wanna bother yourself with that, you can ignore the warning with stats.warningFilter (as shown in the answer given by Czilla) when the order of these styles doesn't matter.

这篇关于mini-css-extract-plugin在块chunkName中的警告[mini-css-extract-plugin]之间的冲突顺序:的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-16 00:19