为vue.config.js文件内容,使用vuecli4
const path = require(‘path’);
const resolve = dir => path.join(__dirname, dir);
const webpack = require(‘webpack’);
const MomentLocalesPlugin = require(‘moment-locales-webpack-plugin’);
let proxyObj={};
…
proxyObj[‘/ws’]={
ws: true,
secure: false,
target: ‘http://192.168.1.1’,
changeOrigin: true,
pathRewrite: {
‘^/ws’: ‘/’
}
}
module.exports = {
publicPath: ‘/’,
runtimeCompiler: false,
transpileDependencies: true,
integrity: false,
…
devServer: {
open: true,
host: ‘127.0.0.1’,
port: 8080,
https: false,
hot: ‘only’,
proxy: proxyObj
},
}
}