[英]SCSS loading error while building React application
I am trying to build a React application using Webpack.我正在尝试使用 Webpack 构建一个 React 应用程序。 I get this error, connected with main SCSS file:
我收到此错误,与主 SCSS 文件有关:
ERROR in ./resources/scss/style.scss (./node_modules/css-loader/dist/cjs.js??ref--6-2!./node_modules/sass-loader/dist/cjs.js!./resources/scss/style.scss)
Module build failed (from ./node_modules/css-loader/dist/cjs.js):
ValidationError: Invalid options object. CSS Loader has been initialized 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?, esModule? }
at validate (C:\Users\User\Documents\Projects\App\client\node_modules\schema-utils\dist\validate.js:96:11)
at Object.loader (C:\Users\User\Documents\Projects\App\client\node_modules\css-loader\dist\index.js:36:28)
I can't understant, what's wrong.我不明白,怎么了。 There are the fragments of my
package.json
and style.scss
:有我的
package.json
和style.scss
的片段:
package.json package.json
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"build": "webpack --mode production",
"start": "webpack-dev-server --mode development --open"
},
"devDependencies": {
"babel": "^6.23.0",
"node-sass": "^4.14.1",
"sass-loader": "^8.0.2",
"style-loader": "^1.2.1",
"webpack": "^4.43.0",
}
style.scss样式.scss
@import "~bootstrap/scss/bootstrap";
body, html {
height: 100%;
background-color: rgba(0,0,0,.018);
color: rgba(0,0,0,.75);
}
I thought that the problem was in dependencies, but I fixed it by deleting option minimize: true
in webpack.config.js
.我认为问题出在依赖项上,但我通过删除选项来修复它,请在
webpack.config.js
中删除选项minimize: true
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.