我用默认模板启动了一个preact-cli
项目。我安装了node-sass
和sass-loader
.我将其中一个.css
文件更改为.scss
然后 whle 东西中断并给出此错误。
✖ ERROR BabelEsmPlugin: ./routes/profile/style.scss (../node_modules/preact-cli/lib/lib/webpack/proxy-loader.js??ref--6-0!./routes/profile/style.scss)
Module build failed (from ../node_modules/preact-cli/lib/lib/webpack/proxy-loader.js):
ValidationError: Invalid options object. Sass Loader has been initialised using an options object that does not match the API schema.
- options has an unknown property 'includePaths'. These properties are valid:
object { implementation?, sassOptions?, prependData?, sourceMap?, webpackImporter? }
at validate (./routes/profile/index.js
@ ./routes/profile/index.js
@ ./components/app.js
@ ./index.js
@ ../node_modules/preact-cli/lib/lib/entry.js
@ multi ../node_modules/webpack-dev-server/client?http://0.0.0.0:8080 ../node_modules/webpack/hot/dev-server.js ../node_modules/preact-cli/lib/lib/entry webpack-dev-server/client webpack/hot/dev-server
此错误适用于 sass-loader 版本 8 你应该使用
yarn add -D sass-loader@7.3.1
(或与 npm 一起(
npm add --save-dev sass-loader@7.3.1
来源于 https://github.com/preactjs/preact-cli/issues/880
如果您使用 sass 加载器选项,也许此快速修复可能会有所帮助(它正在等待合并(https://github.com/preactjs/preact-cli/pull/930
希望这对你有帮助。