module.exports = { publicPath: "/admin-vue/", // 关闭线上源码 productionSourceMap: false, chainWebpack: (config) => { const svgRule = config.module.rule('svg'); svgRule.uses.clear(); svgRule .use('babel-loader') .loader('babel-loader') .end() .use('vue-svg-loader') .loader('vue-svg-loader'); }, devServer: { host: "0.0.0.0", port: 8080, // 端口号 https: false, // https:{type:Boolean} // https: true, open: true, //配置自动启动浏览器 // 配置多个代理 proxy: { "/xcx/api": { target: "https://sws.kuyicloud.com",// 要访问的接口域名https://swstest.sgjyun.com ws: false,// 是否启用websockets changeOrigin: true, //开启代理:在本地会创建一个虚拟服务端,然后发送请求的数据,并同时接收请求的数据,这样服务端和服务端进行数据的交互就不会有跨域问题 pathRewrite: { // '^/xcx/api': '' //这里理解成用'/api'代替target里面的地址,比如我要调用'http://40.00.100.100:3002/user/add',直接写'/api/user/add'即可 } } } } }