sass-resource-loader几周前,我使用3.0版本的CLI成功配置了一个新的Vue项目,使用此处发布的信息:使用sass-resources-loader和vue-cli v3.x
但是,今天更新了所有内容后,我在运行时遇到以下错误npm run serve:
TypeError: Cannot read property 'scss' of undefined
似乎被传递的唯一选项.tap(options)是:
{ compilerOptions: { preserveWhitespace: false } }
我目前还不知道chainWebpack有效调试,但我正在研究它.如果有人对变更导致此错误的内容有任何见解,我们将不胜感激.
我的vue.config.js:
const path = require('path')
module.exports = {
chainWebpack: (config) => {
config
.module
.rule('vue')
.use('vue-loader')
.tap((options) => {
console.log(options)
options.loaders.scss = options.loaders.scss.concat({
loader: 'sass-resources-loader',
options: {
resources: [
path.resolve('./src/scss/_variables.scss'),
path.resolve('./src/scss/_mixins.scss')
]
},
})
return options
})
config
.module
.rule('scss')
.use('sass-resources-loader')
.loader('sass-resources-loader')
.options({
resources: [
path.resolve('./src/scss/_variables.scss'),
path.resolve('./src/scss/_mixins.scss')
]
}) …Run Code Online (Sandbox Code Playgroud) 我正在将我的 Vue CLI 3 项目中的 Vuetify 从版本 1.5 升级到 2。我已按照这些说明进行了完整安装。升级后,运行 'npm run serve' 给了我一大堆类似这样的错误:
error in ./node_modules/vuetify/src/components/VGrid/_grid.sass
Module build failed (from ./node_modules/sass-loader/dist/cjs.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 'indentedSyntax'. These properties are valid:
object { implementation?, sassOptions?, prependData?, sourceMap?, webpackImporter? }
at validate (C:\Users\kristoffer.dahl\Documents\Prosjekter\fridgein\fridgein_fe\node_modules\sass-loader\node_modules\schema-utils\dist\validate.js:50:11)
at Object.loader (C:\Users\kristoffer.dahl\Documents\Prosjekter\fridgein\fridgein_fe\node_modules\sass-loader\dist\index.js:36:28)
Run Code Online (Sandbox Code Playgroud)
除了提到的 Vuetify 组件之外,所有错误看起来都一样。
这是我的package.json:
{
"name": "fridgein_fe",
"version": "0.1.0", …Run Code Online (Sandbox Code Playgroud)