vue.config.js
module.exports = {
publicPath: './',
outputDir: 'dist',
lintOnSave: true,
runtimeCompiler: true,
// 关闭map映射文件
productionSourceMap:false,// 关键点
}
// 安装图片压缩依赖
npm install image-webpack-loader
chainWebpack: config => {
// 开启图片压缩
config.module
.rule('images')
.test(/\.(png|jpe?g|gif|svg)(\?.*)?$/)
.use('image-webpack-loader')
.loader('image-webpack-loader')
.options({ bypassOnDebug: true });
},