npm install sass-loader@7.3.1 --save-dev
npm install node-sass --save
npm install style-loader --save
如果直接 npm install sass-loader --save-dev 会报错
Module build failed: TypeError: this.getResolve is not a function at Object.loader
因为当前sass的版本太高,webpack编译时出现了错误,所以指定:npm install sass-loader@7.3.1 --save-dev 安装低版本的。
接下来,在build/webpack.base.config.js中添加:
{
test: /\.scss$/,
loader: ['style', 'css', 'sass']
},