configureWebpack: (config) => {const configNew = {}
if (process.env.NODE_ENV === 'production') {
configNew.externals = externals
configNew.plugins = [
// gzip
new CompressionWebpackPlugin({filename: '[path].gz[query]',
test: new RegExp('\\.(' + ['js', 'css'].join('|') + ')$'),
threshold: 10240,
minRatio: 0.8,
deleteOriginalAssets: false
})
]
}
return configNew
},
config.module
.rule('md')
.test(/\.md$/)
.use('text-loader')
.loader('text-loader')
.end()
// svg
const svgRule = config.module.rule('svg')
svgRule.uses.clear()
svgRule.include
.add(resolve('src/assets/svg-icons/icons'))
.end()
.use('svg-sprite-loader')
.loader('svg-sprite-loader')
.options({symbolId: 'd2-[name]'
})
.end()