const path = require('path') module.exports = { devServer: { proxy: { '/api': { target: "http://192.168.89.147:8081/", // ws: true, changeOrigin: true, // pathRewrite: { // // 路径重写 // "/api": "" // 这个意思就是以api开头的,定向到哪里, 如果你的后边还有路径的话, 会自动拼接上 // } }, }, }, publicPath: './', chainWebpack (config) { config.resolve.alias .set('@/components', path.resolve(__dirname, 'src/components/')) .set('@/utils', path.resolve(__dirname, 'src/utils/')) } }