1、安装依赖
npm install node-sass sass-loader --save-dev
npm install style-loader css-loader --save-dev
2、修改文件配置webpack.base.config.js
rules下修改:
{
test: /\.vue$/,
loader: 'vue-loader',
options: {
loaders: {
'scss': 'style-loader!css-loader!sass-loader'
}
}
}
添加:
{
test: /\.scss$/,
loaders: ["style","css","sass"] // 顺序不能乱
}
3、使用
<style lang="scss" scoped></style>
网友评论