const path = require('path') // const proxyObj = {} // proxyObj['/'] = { // target: 'http://localhost:8080', // changeOrigin: true, // pathRewrite: { // '^/': '' // } // } module.exports = { // 基本路径 publicPath: './', // 输出文件目录 outputDir: 'dist', configureWebpack: { externals: { } }, devServer: { proxy: { '/api': { target: 'http://localhost:8080', changeOrigin: true, ws: true, pathRewrite: { '^/api': '/mock' } } }, public: require('os').networkInterfaces()[Object.keys(require('os').networkInterfaces())[0]][1].address + ':8080', disableHostCheck: true // host: 'localhost', // port: 8080, // proxy: proxyObj } }