Last active
August 24, 2020 03:04
-
-
Save yeyuguo/e24ee74bf0de49738514c70d89e5eb09 to your computer and use it in GitHub Desktop.
vue webpack webpack-chain sass loader 实现
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
chainWebpack: (config) =>{ | |
// ... | |
// sass 处理 | |
config.module.rules.delete('scss') | |
let scssRule = config.module.rule('scss') | |
.test(/\.scss$/); | |
[ | |
{ name: 'vue-style-loader' }, | |
{ name: 'css-loader' }, | |
{ name: 'sass-loader' }, | |
].forEach((load) => { | |
scssRule | |
.use(load.name) | |
.loader(load.loader || load.name) | |
.options(load.options || {}) | |
}) | |
// ... | |
}) | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
npm install -D sass-loader node-sass