1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
| var path = require("path")
| 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')
| }
| }
| },
| assetsDir: 'static',
| productionSourceMap: false,
| devServer: {
| sockHost: 'localhost',
| port: 8082,
| disableHostCheck: true,
| proxy: {
| '/':{
| 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();
| }
| }
|
|