let proxyObj = {} proxyObj['/'] = { //websocket ws:false, //目标地址 target: 'http://localhost:8081', //发送请求头host会被设置target changeOrigin: true, //不重写请求地址 pathRewrite: { '^/api': '/' } } module.exports = { publicPath: "./", lintOnSave: false, //关闭eslint //修改或新增html-webpack-plugin的值,在index.html里面能读取htmlWebpackPlugin.options.title chainWebpack: config => { config.plugin('html') .tap(args => { args[0].title = "嘉讯茂移动办公平台"; return args; }) }, devServer: { host:'localhost', port: 8082, proxy: proxyObj } }