webpack-contrib / postcss-loader

PostCSS loader for webpack

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Invalid options object. PostCSS Loader has been initialized using an options object that does not match the API schema. - options has an unknown property 'plugins'

rm-f1024 opened this issue · comments

image-20220516195035998

now, I want to do on-demand configuration loaded by customize - cra for Antd(ui libraries)

But,i got this Error,i read a lot of blog documentation that asked me to change the configuration of webpack.

I wouldn't to do this because it had to make me run eject to expose all webpack configuration, I just want to fix it with configuring config-overrides.js file

This is my config-overrides.js
const {override,fixBabelImports,addLessLoader} =require('customize-cra');

module.exports = override(
    fixBabelImports('import',{
        libraryName:'antd',
        libraryDirectory:'es',
        style:true,
    }),
    addLessLoader({
        lessOptions: {
                javascriptEnabled: true,
                modifyVars: { '@primary-color': '#1DA57A' },//自定义主题
       }
        
    })
    
    
);

package.json

{
  "name": "test1",
  "version": "0.1.0",
  "private": true,
  "dependencies": {
    "antd": "^4.20.5",
    "babel-plugin-import": "^1.13.5",
    "customize-cra": "^1.0.0",
    "less": "^4.1.2",
    "less-loader": "7.3.0",
    "postcss-loader": "4",
    "react": "^16.2.0",
    "react-app-rewired": "^2.2.1",
    "react-dom": "^16.0.0",
    "react-scripts": "5.0.1"
  },
  "scripts": {
    "start": "react-app-rewired start",
    "build": "react-app-rewired build",
  "browserslist": {
    "development": [
      "last 1 chrome version",
      "last 1 firefox version",
      "last 1 safari version"
    ]
  }
}

Please open an issue in customize-cra, it is custom implementation, sorry, I can't help with this here