After configuring less in create-react-app, antd reported an error?

recently, I was learning to use create-react-app scaffolding in antd,. According to the configuration of less, on the Internet, but after start, ant reported an error.

webpack.configi.dev configuration Code

{
            test: /\.(css|less)$/,
            use: [
              require.resolve("style-loader"),
              {
                loader: require.resolve("css-loader"),
                options: {
                  importLoaders: 1,
                },
              },
              {
                loader: require.resolve("postcss-loader"),
                options: {
                  // Necessary for external CSS imports to work
                  // https://github.com/facebookincubator/create-react-app/issues/2677
                  ident: "postcss",
                  plugins: () => [
                    require("postcss-flexbugs-fixes"),
                    autoprefixer({
                      browsers: [
                        ">1%",
                        "last 4 versions",
                        "Firefox ESR",
                        "not ie < 9", // React doesn"t support IE8 anyway
                      ],
                      flexbox: "no-2009",
                    }),
                  ],
                },
              },
              {
                  loader: require.resolve("less-loader") // compiles Less to CSS
              }
            ],
          },

error message

./node_modules/antd/dist/antd.css
Module build failed: 
  /* autoprefixer: off */
  filter: progid\:DXImageTransform\.Microsoft\.Blur(PixelRadius\=1, MakeShadow\=false);             
Unrecognised input
 in /Users/heliu/Desktop/ant-echarts/node_modules/antd/dist/antd.css (line 15367, column 16)
Mar.01,2021

less what is the version? 3.0.0 add one more option to the configuration javascriptEnabled: true . For this kind of question, take a look at issue above github much faster than you asked.


less-loader does not support that attribute css and less (webpackconfig) write separately,


https://github.com/ZhangLynn/.


how did you solve the problem in the end? I can't add jaascriptEnabled to it.


@ Qingzhan is the version of less-loader, don't wear it askew

{
  loader: require.resolve('less-loader'),
  options: {
    javascriptEnabled: true
  }
}
Menu