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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
| // 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)
| }
| module.exports = {
| publicPath,
| lintOnSave: false,
| productionSourceMap: false, // 如果你不需要生产环境的source map, 可以将其设置为false 以加速生产环境构建
| devServer: {
| proxy: {
| "/api/base": {
| target: "http://192.168.20.118:8001",
| ws: true,
| changeOrigin: true
| },
| "/api/salesLeads": {
| target: "http://192.168.20.118:8001",
| ws: true,
| changeOrigin: true
| },
| "/api/followRecord": {
| target: "http://192.168.20.118:8001",
| ws: true,
| changeOrigin: true
| },
| "/api-s": {
| target: "http://192.168.20.119:9081",
| ws: true,
| changeOrigin: true
| },
| "/api": {
| target: "http://192.168.20.118:8001",
| ws: true,
| changeOrigin: true
| }
| // "/api-s": {
| // target: "http://192.168.20.113:9081",
| // ws: true,
| // changeOrigin: true,
| // },
| }
| },
| transpileDependencies: [
| // 兼容IE11浏览器(兼容npm包和cnpm包)
| "crypto-js",
| "sockjs-client"
| ],
| configureWebpack: (config) => {
| 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"
| }
| },
| chainWebpack(config) {
| // 设置svg导入
| config.module.rule("svg").exclude.add(resolve("srv/assets/icons")).end()
| config.module
| .rule("icons")
| .test(/\.svg$/)
| .include.add(resolve("src/assets/icons"))
| .end()
| .use("svg-sprite-loader")
| .loader("svg-sprite-loader")
| .options({
| symbolId: "icon-[name]"
| })
| .end()
| },
| css: {
| loaderOptions: {
| // 设置 scss 公用变量文件
| sass: {
| additionalData: `@import "@/assets/style/variable.scss";`
| }
| }
| }
| }
|
|