vue.config.js
1.95 KB
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
/*
* @Author: your name
* @Date: 2021-12-24 14:16:06
* @LastEditTime: 2022-02-14 15:02:53
* @LastEditors: Please set LastEditors
* @Description: 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
* @FilePath: /sdc-face/API20211215/vue.config.js
*/
const CopyWebpackPlugin = require("copy-webpack-plugin") //引入插件
module.exports = {
outputDir:process.env.outputDir || 'dist',
productionSourceMap: false,
lintOnSave: false,
publicPath: "./",
// 由于浏览器有跨域限制,这里cli 工具提供了 启动本地代理服务器 请求
devServer:{
open:false, // 是否打开浏览器;
hotOnly:true, // 是否热更新;
proxy:{
'/SDCAPI':{ // 路径中有 /api 的请求都会走这个代理 , 可以自己定义一个,下面移除即可
// target:'http://huayan.320.io/', // 目标代理接口地址,实际跨域要访问的接口,这个地址会替换掉 axios.defaults.baseURL
target:'http://3d1576a219.wicp.vip/',
secure:false,
changeOrigin:true, // 开启代理,在本地创建一个虚拟服务端
ws:true, // 是否启用 websockets;
pathRewrite:{ // 去掉 路径中的 /api 的这一截
'^/api':''
}
},
'/test':{
target:'http://v.juhe.cn/joke', // 目标代理接口地址,实际跨域要访问的接口,这个地址会替换掉 axios.defaults.baseURL
secure:false,
changeOrigin:true,
ws:true,
pathRewrite:{
'^/test':'',
}
}
},
},
configureWebpack: {
plugins: [
new CopyWebpackPlugin([ //打包时执行拷贝
{
from: __dirname + "/public/config/js/config.js",
to: __dirname + "/dist/config/js/config.js"
}
])
]
},
}