const path = require('path') module.exports = { // 基本路径 publicPath: './', // 输出文件目录 outputDir: 'dist', configureWebpack: { externals: { } }, devServer: { proxy: { '/api': { target: 'http://localhost:8080', changeOrigin: true, ws: true, pathRewrite: { '^/api': '/mock' } } } } // productionSourceMap: false, // devServer: { // proxy: { // '/test': { // target: "http://47.105.143.227:3000",//这个是你要访问的接口地址 // changeOrigin: true, // pathRewrite: {//重写地址 比如说 你的接口地址是'https://188.62.63/xxyy/getUser' 你请求得时候地址只需要写'/test/getUser' // '/test': '/xxyy' // } // } // } // } }