ant-design / ant-design-landing

:mountain_bicyclist: Landing Pages of Ant Design System
https://landing.ant.design/
MIT License
6.17k stars 632 forks source link

Module build failed (from ./node_modules/postcss-loader/dist/cjs.js): ValidationError: Invalid options object. PostCSS Loader has been initialized using an options object that does not match the API schema. #365

Open meowwww88hen opened 2 years ago

meowwww88hen commented 2 years ago
Screenshot 2022-01-08 at 3 43 37 PM

有人遇到同样的问题吗?

bayuec commented 2 years ago

一样的问题

lazy1523 commented 2 years ago

me too

crzyjcky commented 2 years ago

After spending more than a week to fix the error (I almost give up), I found the solution here: https://github.com/arackaf/customize-cra/issues/315#issuecomment-1017081592

TLDR - add the following lines in config-overrides.js:

const { override, fixBabelImports, addLessLoader, adjustStyleLoaders } = require('customize-cra');

module.exports = override(
  // Load antd
  fixBabelImports('import', { ... }),

  // Add `javascriptEnabled` and antd theme configuration
  // to the Less loader
  addLessLoader({ ... }),

  adjustStyleLoaders(({ use: [, , postcss] }) => {
    const postcssOptions = postcss.options;
    postcss.options = { postcssOptions };
  })
);
RuotongX commented 2 years ago

After spending more than a week to fix the error (I almost give up), I found the solution here: arackaf/customize-cra#315 (comment)

TLDR - add the following lines in config-overrides.js:

const { override, fixBabelImports, addLessLoader, adjustStyleLoaders } = require('customize-cra');

module.exports = override(
  // Load antd
  fixBabelImports('import', { ... }),

  // Add `javascriptEnabled` and antd theme configuration
  // to the Less loader
  addLessLoader({ ... }),

  adjustStyleLoaders(({ use: [, , postcss] }) => {
    const postcssOptions = postcss.options;
    postcss.options = { postcssOptions };
  })
);

This works for me! Thanks, dude, it is a very helpful answer.

Jot4ril commented 2 years ago

Guys, please I'm new to coding and don't know how to implement this in my code. Please can anyone help me further

Nero978 commented 1 year ago

After spending more than a week to fix the error (I almost give up), I found the solution here: arackaf/customize-cra#315 (comment)

TLDR - add the following lines in config-overrides.js:

const { override, fixBabelImports, addLessLoader, adjustStyleLoaders } = require('customize-cra');

module.exports = override(
  // Load antd
  fixBabelImports('import', { ... }),

  // Add `javascriptEnabled` and antd theme configuration
  // to the Less loader
  addLessLoader({ ... }),

  adjustStyleLoaders(({ use: [, , postcss] }) => {
    const postcssOptions = postcss.options;
    postcss.options = { postcssOptions };
  })
);

It's very useful!! Thanks for your help!

cj348986512 commented 11 months ago

encountered same problem, after I deleted below config in vue.config.js, it worked: css: {, loaderOptions: { postcss: { plugins: [ require("postcss-pxtorem")({ rootValue: 14, propList: ["*"], }), ], }, }, },