Skip to content

Instantly share code, notes, and snippets.

@agileago
Created November 20, 2018 09:45
Show Gist options
  • Save agileago/52cf2076aba823280037e9f5f9e03d31 to your computer and use it in GitHub Desktop.
Save agileago/52cf2076aba823280037e9f5f9e03d31 to your computer and use it in GitHub Desktop.
vue config
const path = require('path')
function resolve(dir) {
return path.join(__dirname, '.', dir)
}
module.exports = {
baseUrl: './',
productionSourceMap: false,
chainWebpack: config => {
config.plugins.delete('preload')
// config.plugins.delete('prefetch')
config
.plugin('html')
.tap(args => {
args[0].minify = false
return args
})
config.externals({
'vue': 'Vue',
'vue-router': 'VueRouter',
'vuex': 'Vuex'
})
config.module.rules.delete('svg')
config.module
.rule('svg-sprite-loader')
.test(/\.svg$/)
.include
.add(resolve('src/icons')) //处理svg目录
.end()
.use('svg-sprite-loader')
.loader('svg-sprite-loader')
.options({
symbolId: 'icon-[name]'
})
},
devServer: {
disableHostCheck: true
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment