| | |
| | | module.exports = { |
| | | baseUrl: './', |
| | | configureWebpack: { |
| | | optimization: { |
| | | minimizer: [ |
| | | new (require('terser-webpack-plugin'))({ |
| | | terserOptions: { |
| | | compress: { |
| | | drop_console: true, // 删除生产环境console.log |
| | | drop_debugger: true, // 删除debugger |
| | | } |
| | | } |
| | | }) |
| | | ] |
| | | }, |
| | | resolve: { |
| | | alias: { |
| | | '@': path.join(__dirname, 'src') |
| | |
| | | productionSourceMap: false, |
| | | devServer: { |
| | | sockHost: 'localhost', |
| | | port: 8082, |
| | | disableHostCheck: true, |
| | | proxy: { |
| | | '/':{ |
| | | //target:'http://183.196.93.178', |
| | | target:'http://127.0.0.1:8089', |
| | | target:'http://183.196.93.178:8089', |
| | | //target:'http://127.0.0.1:8089', |
| | | changeOrigin:true, |
| | | pathRewrite:{ |
| | | '/':'' |
| | | } |
| | | } |
| | | } |
| | | }, |
| | | chainWebpack : config => { |
| | | // 图片压缩(需要安装image-webpack-loader:npm install image-webpack-loader -D) |
| | | config.module |
| | | .rule('images') |
| | | .use('image-webpack-loader') |
| | | .loader('image-webpack-loader') |
| | | .options({ |
| | | mozjpeg: { progressive: true, quality: 65 }, |
| | | optipng: { enabled: false }, |
| | | pngquant: { quality: [0.65, 0.9], speed: 4 }, |
| | | gifsicle: { interlaced: false }, |
| | | webp: { quality: 75 } // WebP压缩质量 |
| | | }) |
| | | .end(); |
| | | } |
| | | } |