yangfeng
2023-07-24 dd3d892936eff96a4418cfaa8f3c4219dfa23f1d
vue.config.js
@@ -1,13 +1,12 @@
// const { defineConfig } = require("@vue/cli-service")
// module.exports = defineConfig({
//   transpileDependencies: true
// })
const path = require("path")
// 基础路径 注意发布之前要先修改这里
const publicPath = "/"
function resolve(dir) {
  return path.join(__dirname, dir)
}
// 设置不参与构建的库
const externals = {}
module.exports = {
  publicPath,
  lintOnSave: false,
@@ -15,17 +14,17 @@
  devServer: {
    proxy: {
      "/api/base": {
        target: "http://192.168.20.118:8001",
        target: "http://192.168.20.119:8002",
        ws: true,
        changeOrigin: true
      },
      "/api/salesLeads": {
        target: "http://192.168.20.118:8001",
        target: "http://192.168.20.119:8002",
        ws: true,
        changeOrigin: true
      },
      "/api/followRecord": {
        target: "http://192.168.20.118:8001",
        target: "http://192.168.20.119:8002",
        ws: true,
        changeOrigin: true
      },
@@ -35,7 +34,7 @@
        changeOrigin: true
      },
      "/api": {
        target: "http://192.168.20.118:8001",
        target: "http://192.168.20.119:8002",
        ws: true,
        changeOrigin: true
      }
@@ -52,21 +51,14 @@
    "sockjs-client"
  ],
  configureWebpack: (config) => {
    const configNew = {}
    if (process.env.NODE_ENV === "production") {
      // 为生产环境修改配置
      config.optimization.minimizer[0].options.terserOptions.compress.warings = false
      config.optimization.minimizer[0].options.terserOptions.compress.drop_console = true
      config.optimization.minimizer[0].options.terserOptions.compress.drop_debugger = true
      config.optimization.minimizer[0].options.terserOptions.compress.pure_funcs = ["console.log"]
      config.performance = {
        hints: "warning",
        maxEntrypointSize: 20000000, // 入口起点的最大体积
        maxAssetSize: 10000000 // 生成文件的最大体积
      }
    } else {
      // 为开发环境修改配置
      config.devtool = "eval-source-map"
      configNew.externals = externals
      configNew.plugins = []
    } else if (process.env.NODE_ENV === "development") {
      console.log("development", config)
    }
    return configNew
  },
  chainWebpack(config) {
    // 设置svg导入