Skip to content

Instantly share code, notes, and snippets.

@yeyuguo
Last active August 24, 2020 03:04
Show Gist options
  • Save yeyuguo/e24ee74bf0de49738514c70d89e5eb09 to your computer and use it in GitHub Desktop.
Save yeyuguo/e24ee74bf0de49738514c70d89e5eb09 to your computer and use it in GitHub Desktop.
vue webpack webpack-chain sass loader 实现
{
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 || {})
})
// ...
})
}
@yeyuguo
Copy link
Author

yeyuguo commented Aug 24, 2020

npm install -D sass-loader node-sass

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment