const path = require('path') const resolve = dir => path.join(__dirname, dir) module.exports = { devServer: { proxy: { '/api': { target: "http://192.168.89.147:8089/", // ws: true, changeOrigin: true, // pathRewrite: { // // 路径重写 // "/api": "" // 这个意思就是以api开头的,定向到哪里, 如果你的后边还有路径的话, 会自动拼接上 // } }, }, }, lintOnSave: false, publicPath: "./",//在vue-cli.3.3版本后 baseUrl被废除了,因此这边要写成 publicPath。 https://cli.vuejs.org/zh/config/#vue-config-js runtimeCompiler: true, chainWebpack: config => { config.resolve.alias.set("@", resolve("src")); } }