zhangyanpeng
2024-03-04 6a72e9e44dc7278e18d55ccd5637b81a1cb2f047
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
const path = require("path");
 
module.exports = {
  publicPath: './',
  lintOnSave: false,
  outputDir: "dist",
  // 开发环境显示报错位置 生产环境设置为false减少打包体积
  productionSourceMap: false,
// 跨域的代理中转服务器服务
 
  devServer: {
    port: 88,
    disableHostCheck: true,
    proxy: {
      "/api":{   // /vue代理target
        target: 'http://grand-dev.highdatas.com',      // 后端接口的根目录
        // secure: true,           // 如果是 https ,需要开启这个选项,http为false
        changeOrigin: true,        // 是否跨域
        pathRewrite: {            // 是否重写路径,看代理前端路径是否与后端路径一致
          '^/api':'', //将所有含/api路径的,去掉/api转发给服务器
        }
      }
    },
    /*overlay: {
      warning: false,
      errors: false
    }*/
 
  },
 
  pluginOptions: {
    "style-resources-loader": {
      preProcessor: "less",
      patterns: [
        // 全局变量路径,不能使用路径别名
        path.resolve(__dirname, "./src/assets/theme.less"),
      ],
    },
  },
 
 
}