The webpack plug-in extracts css warning conflicts how to resolve antd

WARNING in chunk vendors [mini-css-extract-plugin]
Conflicting order between:
 * css ./node_modules/css-loader!./node_modules/postcss-loader/src!./node_modules/antd/lib/select/style/index.css
 * css ./node_modules/css-loader!./node_modules/postcss-loader/src!./node_modules/antd/lib/tooltip/style/index.css
 * css ./node_modules/css-loader!./node_modules/postcss-loader/src!./node_modules/antd/lib/modal/style/index.css
 * css ./node_modules/css-loader!./node_modules/postcss-loader/src!./node_modules/antd/lib/icon/style/index.css
 * css ./node_modules/css-loader!./node_modules/postcss-loader/src!./node_modules/antd/lib/grid/style/index.css
 * css ./node_modules/css-loader!./node_modules/postcss-loader/src!./node_modules/antd/lib/input/style/index.css
 * css ./node_modules/css-loader!./node_modules/postcss-loader/src!./node_modules/antd/lib/message/style/index.css
 * css ./node_modules/css-loader!./node_modules/postcss-loader/src!./node_modules/antd/lib/auto-complete/style/index.css
webpack4
,

const styleLoader = devMode ? "style-loader" : MiniCssExtractPlugin.loader;
{
        test: /\.css$/,
        use: [styleLoader, "css-loader", "postcss-loader"]
      },
      {
        test: /\.less$/,
        use: [{
          loader: styleLoader
        }, {
          loader: "css-loader"
        }, {
          loader: "postcss-loader"
        }, {
          loader: "less-loader"
        }]
      },
      {
        test: /\.scss$/,
        use: [{
          loader: styleLoader
        }, {
          loader: "css-loader"
        }, {
          loader: "postcss-loader"
        }, {
          loader: "sass-loader"
        }]
      },
     babel 
   "plugins": [
    ["import", 
      {
        "libraryName": "antd",
        "style": "css"
      },
      "loadsh"
    ],
    "@babel/plugin-transform-modules-commonjs",
    "@babel/plugin-proposal-class-properties"
  ]
Aug.20,2021

this warning can actually be ignored, because we don't care that css is basically messy in the loading order of different files, especially old projects.
so, the solution is to ignore this warning in development mode:

  • install webpack-filter-warnings-plugin
npm i webpack-filter-warnings-plugin -D
  • modify webpack.config.js to add a plug-in for ignore
const FilterWarningsPlugin = require('webpack-filter-warnings-plugin');

...

plugins: [
    ...
    new FilterWarningsPlugin({
        exclude: /mini-css-extract-plugin[^]*Conflicting order between:/,
    }),
    ...
]

  

classmate, you finally solved it.

Menu