admin管理员组文章数量:1415653
I was trying to add global scss variables to my Vue project. I found this example Globally load sass. So I created vue.config.js
in my root folder of my Vue project then I copy & paste vue.config.js
and change the data inport path and then when I am trying to serve my project I am getting this error :
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 'data'. These properties are valid: object { implementation?, sassOptions?, prependData?, sourceMap?, webpackImporter? } at validate
I checked my package.json
to just be sure that I have installed node-sass
and sass-loader
and I found those dependencies :
"devDependencies": {
"@vue/cli-plugin-babel": "^4.1.0",
"@vue/cli-plugin-router": "^4.1.2",
"@vue/cli-service": "^4.1.0",
"babel-eslint": "^10.0.3",
"node-sass": "^4.12.0",
"sass-loader": "^8.0.0",
"vue-template-piler": "^2.6.10"
}
So I am a little bit confused and I do not know what I am doing wrong. I also know that I can import those .scss
variables to every vue ponent in which i am going to use them but i do not like this solution.
vue.config.js
module.exports = {
css: {
loaderOptions: {
sass: {
data: `
@import "@/style/index.scss";
`
}
}
}
};
Directory structure
I was trying to add global scss variables to my Vue project. I found this example Globally load sass. So I created vue.config.js
in my root folder of my Vue project then I copy & paste vue.config.js
and change the data inport path and then when I am trying to serve my project I am getting this error :
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 'data'. These properties are valid: object { implementation?, sassOptions?, prependData?, sourceMap?, webpackImporter? } at validate
I checked my package.json
to just be sure that I have installed node-sass
and sass-loader
and I found those dependencies :
"devDependencies": {
"@vue/cli-plugin-babel": "^4.1.0",
"@vue/cli-plugin-router": "^4.1.2",
"@vue/cli-service": "^4.1.0",
"babel-eslint": "^10.0.3",
"node-sass": "^4.12.0",
"sass-loader": "^8.0.0",
"vue-template-piler": "^2.6.10"
}
So I am a little bit confused and I do not know what I am doing wrong. I also know that I can import those .scss
variables to every vue ponent in which i am going to use them but i do not like this solution.
vue.config.js
module.exports = {
css: {
loaderOptions: {
sass: {
data: `
@import "@/style/index.scss";
`
}
}
}
};
Directory structure
Share Improve this question edited Jan 5, 2020 at 21:17 custommander 19.1k6 gold badges69 silver badges93 bronze badges asked Jan 5, 2020 at 20:45 Krzysztof KaczyńskiKrzysztof Kaczyński 5,0916 gold badges35 silver badges61 bronze badges1 Answer
Reset to default 5Change data
to prependData
...see the docs
本文标签: javascriptHow can I fix ValidationError of Sass loaderStack Overflow
版权声明:本文标题:javascript - How can I fix ValidationError of Sass loader? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745188670a2646805.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论