Home > Web Front-end > Vue.js > Example to solve the error that occurs when using lang='scss' in vue

Example to solve the error that occurs when using lang='scss' in vue

WBOY
Release: 2022-08-10 11:43:27
forward
4275 people have browsed it

This article brings you relevant knowledge about vue, which mainly introduces the related issues about using lang="scss" to report errors. This is because the current version of sass-loader is too high. , an error occurred during webpack compilation. Let’s take a look at it. I hope it will be helpful to everyone.

Example to solve the error that occurs when using lang='scss' in vue

【Related recommendations: javascript video tutorial, vue.js tutorial

vue uses lang= "scss" error

When writing the VUE online editor, in order to make the style more beautiful, add lang="scss" to the style, and the following error will be displayed:

Example to solve the error that occurs when using lang=scss in vue

This is because the current version of sass-loader is too high, and an error occurred during webpack compilation, so we installed a lower version
Enter the following commands in the project in sequence:
npm install sass-loader@7.3.1 --save-dev
npm install node-sass --save
npm install style-loader --save
Copy after login
In this way, no error will be reported when using lang="scss"

Cannot use the command directly:

npm install sass-loader --save-dev
Copy after login

Otherwise, the following error will be reported:

Module build failed: TypeError: this.getResolve is not a function at Object.loader
Copy after login

Because of the current sass version If it is too high, an error occurred during webpack compilation, so specify: npm install sass-loader@7.3.1 --save-dev to install a lower version.

Next, add in build/webpack.base.config.js:

{
        test: /\.scss$/,
        loaders: ['style', 'css', 'sass']
      }
Copy after login

As shown:

Example to solve the error that occurs when using lang=scss in vue

[Related recommendations :javascript video tutorialvue.js tutorial

The above is the detailed content of Example to solve the error that occurs when using lang='scss' in vue. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
vue
source:csdn.net
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template