-
Notifications
You must be signed in to change notification settings - Fork 4.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
编译警告 chunk common [mini-css-extract-plugin] #7160
Comments
看报错信息应该是不同组件引用的css重名问题 |
能否提供个 demo 看下 |
@lang-strive webpack-contrib/mini-css-extract-plugin#250 (comment) 自己调一下 import 顺序吧,大概意思是 mini-css-extract-plugin 需要按引用顺序去生成 css 文件,如果多个文件引入顺序不一就会警告。 |
我出现该问题的是引入了AtButton的scss,但是并未引入该组件 We are trying to generate a CSS file but your codebase has multiple possible orderings for these modules. In this case you used table before button in one location and button before table in another location. We need to generate a single CSS file for these and can't decide which one should be first. In this case we put table before button. But this is chosen without reason. In future build we may decide the other way. But since CSS cares for rule order this can lead to issue when CSS changes without reason. So not defining a clear order can lead to fragile builds, that's why we display a warning here. There are two things that you can do: Sort your imports to create a consistent order. I must admit that the warning could be improved to point to the locations that need to be changed. Ignore the warning with stats.warningFilter when the order of these styles doesn't matter. Maybe the eventually add an option to mark order-independent styles directly. |
page引用了多个组件的顺序不一样也会导致样式的引用顺序不一样,这个有没有比较推荐的引用方式呢? |
感觉,这个还是 reopen 吧。我这边也有这个现象。 |
好像Taro2版本没有出现过这个问题 |
There is now an NPM package named @webkrafters/ordercss which tackles this issue. Full disclosure: I initially created it to solve this very problem in one of my apps but decided to expand it and share it with everyone. If this package helps anyone, please share it with others. Thanks and good luck! |
在 config/index.js 下添加如下配置
|
上面的朋友的配置确实有效,但是不处理好冲突, |
原因是组件引入顺序不一样 |
@Developer27149 +1 |
Resolved after adding rule Here's my eslint config
|
太棒了!是这个原因,报错上面页提示了是哪个页面,对比页面,更改组件顺序就好了 |
这个错误在Taro的场景下会不会造成其他潜在问题? |
相关平台
微信小程序
小程序基础库: 2.12.0
使用框架: React
复现步骤
npm run dev:weapp 随后出现 编译警告 .⚠️ 编译警告.
chunk common [mini-css-extract-plugin]
Conflicting order between:
期望结果
我大概知道是css问题,希望知道怎么解决 是偶尔一次出现的 后面一直就编译警告提示
实际结果
编译警告 chunk common [mini-css-extract-plugin]
环境信息
The text was updated successfully, but these errors were encountered: