J
J
JastaFly2020-07-11 18:17:03
Sass
JastaFly, 2020-07-11 18:17:03

How to add SCSS to Vue?

Good day to all! How to use preprocessors with Vue?!?? It seems that I do everything as per the docks , I installed sass loader, but as soon as I add the lang="scss" attribute, I immediately get an error:
Failed to compile.

./node_modules/css-loader?{"sourceMap":true}!./node_modules/vue-loader/lib/style-compiler?{"vue":true,"id":"data-v-7ba5bd90"," scoped":false,"hasInlineConfig":false}!./node_modules/sass-loader/dist/cjs.js?{"sourceMap":true}!./node_modules/vue-loader/lib/selector.js?type= styles&index=0!./src/App.vue
Module build failed: TypeError: loaderContext.getResolve is not a function
at getWebpackImporter (C:\Projects\mocard\mosoft\node_modules\sass-loader\dist\utils.js:274: 37)
at Object.loader (C:\Projects\mocard\mosoft\node_modules\sass-loader\dist\index.js:42:61)
@ ./node_modules/vue-style-loader!./node_modules/css-loader?{ "sourceMap":true}!./node_modules/vue-loader/lib/style-compiler?{"vue":true,"id":"data-v-7ba5bd90","scoped":false,"hasInlineConfig": false}!./node_modules/sass-loader/dist/cjs.js?{"sourceMap":true}!./node_modules/vue-loader/lib/selector.js?type=styles&index=0!./src/App .vue 4:14-357 13:3-17:5 14:22-365
@ ./src/App.vue
@ ./src/main.js
@ multi (webpack)-dev-server/client? localhost:8080 webpack/hot/dev-server ./src/main.js Tell me
what's wrong?!??

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Arseny, 2020-07-11
Matytsyn @ArsenyMatytsyn

Install node-sass and sass-loader in the project (if I remember correctly), and write lang=sass in the style of the component. With the packages installed, webpack itself will figure out what needs to be sucked in order for the project to start. Its “config”, by the way, is located in package.json during such generation.
In a sense, yes, not only a sass-loader is needed, but in principle a sass package

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question