ValidationError:无效的选项对象。CSS Loader已使用与API模式不匹配的选项对象进行了初始化

JavaScript React.js

斯丁

2020-03-24

@zeit/next-css用来将css文件导入到我的组件和页面文件中,但是却抛出了这个错误

./styles/navbar.css导入此css文件到我的navbar.jsin组件中,出现此错误

ValidationError: Invalid options object. CSS Loader has been initialised using
     an options object that does not match the API schema.
- options has an unknown property 'minimize'. These properties are valid:
   object { url?, import?, modules?, sourceMap?, importLoaders?, localsConvention?, onlyLocals? }

next.config.js放在哪里package.json

const withCSS = require("@zeit/next-css");
module.exports = withCSS();

我的包json

{
  "name": "transfer-to",
  "version": "0.1.0",
  "private": true,
  "scripts": {
    "dev": "next dev",
    "build": "next build",
    "start": "next start"
  },
  "dependencies": {
    "@zeit/next-css": "^1.0.1",
    "isomorphic-unfetch": "^3.0.0",
    "next": "9.0.7",
    "react": "16.10.2",
    "react-dom": "16.10.2"
  }
}

第3563篇《ValidationError:无效的选项对象。CSS Loader已使用与API模式不匹配的选项对象进行了初始化》来自Winter(https://github.com/aiyld/aiyld.github.io)的站点

1个回答
Stafan神奇 2020.03.24

为了临时解决您的问题,请从以下软件包中删除“ ^”符号:

"dependencies": {
    "@zeit/next-css": "1.0.1",
    "@zeit/next-sass": "1.0.1",
    "next": "9.0.2",
    "node-sass": "4.12.0"
    ...
  }

这些软件包的更新版本似乎有问题。

问题类别

JavaScript Ckeditor Python Webpack TypeScript Vue.js React.js ExpressJS KoaJS CSS Node.js HTML Django 单元测试 PHP Asp.net jQuery Bootstrap IOS Android