1.装包
cnpm i sass-loader -D
peerDependencies WARNING sass-loader@* requires a peer of node-sass@^4.0.0 but none was installed
peerDependencies WARNING sass-loader@* requires a peer of sass@^1.3.0 but none was installed
peerDependencies WARNING sass-loader@* requires a peer of fibers@>= 3.1.0 but none was installed
使用npm安装sass-loader一般是安装不下来的,所以使用cnpm安装
cnpm i node-sass -D
2.配置规则
module:{//这个节点,用于配置所有第三方模块加载器
rules:[//所有第三方模块的匹配规则
{test:/.scss$/,use:['style-loader','css-loader','sass-loader']},//配置处理.scss文件的第三方loader规则
]
}
注意:webpack 1.x版本匹配规则可以省略loader
rules:[//所有第三方模块的匹配规则
{test:/.scss$/,use:['style','css','sass']},//配置处理.scss文件的第三方loader规则
]