const CompressionPlugin = require("compression-webpack-plugin"); module.exports = { // publicPath: process.env.NODE_ENV === 'production' // ? '/infoVue/' // : '/', publicPath:'./', // outputDir: 'dist', // assetsDir: 'static', productionSourceMap:false, configureWebpack: () => { if (process.env.NODE_ENV === 'production') { return { plugins: [ new CompressionPlugin({ test: /\.js$|\.html$|\.css$|\.jpg$|\.jpeg$|\.png/, // 需要压缩的文件类型 threshold: 10240, // 归档需要进行压缩的文件大小最小值,我这个是10K以上的进行压缩 deleteOriginalAssets: false // 是否删除原文件 }) ] } } }, lintOnSave:false, // 配置反向代理 devServer: { // https: true, port: 8092, proxy:{ "/collection": { target: "http://127.0.0.1:7001", // 本机地址 // target: "https://3586m61d02.yicp.fun", // 本机地址 -CH 测试用的 // target: "https://mz.tshe.cn/collection", // 生产后端路径 // target: "https://tfxs.ccsckj.com/collection", // 生产后端路径-X // target: "https://info.windd.cn/collection", // 生产后端路径 ws: true, // 是否启用websockets changeOrigin: true, //开启代理:在本地会创建一个虚拟服务端,然后发送请求的数据,并同时接收请求的数据,这样服务端和服务端进行数据的交互就不会有跨域问题 pathRewrite: { "^/collection": "" //这里理解成用'/api'代替target里面的地址,比如我要调用'http://40.00.100.100:3002/user/add',直接写'/api/user/add'即可 } }, // "/obs-demo": { // target: "http://abc.ccsckj.com/obs-demo", // 祥云OBS // // target: "http://127.0.0.1:8080/obs-demo", // 祥云OBS // ws: true, // 是否启用websockets // changeOrigin: true, //开启代理:在本地会创建一个虚拟服务端,然后发送请求的数据,并同时接收请求的数据,这样服务端和服务端进行数据的交互就不会有跨域问题 // pathRewrite: { // "^/obs-demo": "" //这里理解成用'/api'代替target里面的地址,比如我要调用'http://40.00.100.100:3002/user/add',直接写'/api/user/add'即可 // } // } }, } };