const path = require('path') const resolve = dir => { return path.join(__dirname, dir) } // 项目部署基础 // 例如:https://www.my-app.com/ // 默认:'/' // 如果您的应用程序部署在子路径中,则需要在这指定子路径 // 例如:https://www.foobar.com/my-app/ // 需要将它改为'/my-app/' // iview-admin线上演示打包路径: https://file.iviewui.com/admin-dist/ const BASE_URL = process.env.NODE_ENV === 'production' ? '/' : '/' module.exports = { devServer: { port: 8890, proxy: { // Index routes '/login': { target: 'http://localhost:3000', changeOrigin: true }, '/base': { target: 'http://localhost:3000', changeOrigin: true }, '/modifyPwd': { target: 'http://localhost:3000', changeOrigin: true }, '/allLanguage': { target: 'http://localhost:3000', changeOrigin: true }, '/upload': { target: 'http://localhost:3000', changeOrigin: true }, '/avatarUpload': { target: 'http://localhost:3000', changeOrigin: true }, // Other API routes '/admin': { target: 'http://localhost:3000', changeOrigin: true }, '/accountUsage': { target: 'http://localhost:3000', changeOrigin: true }, '/config': { target: 'http://localhost:3000', changeOrigin: true }, '/dc': { target: 'http://localhost:3000', changeOrigin: true }, '/exchange': { target: 'http://localhost:3000', changeOrigin: true }, '/firstname': { target: 'http://localhost:3000', changeOrigin: true }, '/lastname': { target: 'http://localhost:3000', changeOrigin: true }, '/group': { target: 'http://localhost:3000', changeOrigin: true }, '/groupJoinLog': { target: 'http://localhost:3000', changeOrigin: true }, '/groupListener': { target: 'http://localhost:3000', changeOrigin: true }, '/groupMember': { target: 'http://localhost:3000', changeOrigin: true }, '/groupMuster': { target: 'http://localhost:3000', changeOrigin: true }, '/groupSendLog': { target: 'http://localhost:3000', changeOrigin: true }, '/groupTask': { target: 'http://localhost:3000', changeOrigin: true }, '/lines': { target: 'http://localhost:3000', changeOrigin: true }, '/message': { target: 'http://localhost:3000', changeOrigin: true }, '/messageMuster': { target: 'http://localhost:3000', changeOrigin: true }, '/param': { target: 'http://localhost:3000', changeOrigin: true }, '/performer': { target: 'http://localhost:3000', changeOrigin: true }, '/pullMemberLog': { target: 'http://localhost:3000', changeOrigin: true }, '/pullMemberProjectStatistic': { target: 'http://localhost:3000', changeOrigin: true }, '/pullMemberStatistic': { target: 'http://localhost:3000', changeOrigin: true }, '/pullMemberTask': { target: 'http://localhost:3000', changeOrigin: true }, '/script': { target: 'http://localhost:3000', changeOrigin: true }, '/scriptProject': { target: 'http://localhost:3000', changeOrigin: true }, '/scriptTask': { target: 'http://localhost:3000', changeOrigin: true }, '/tgAccount': { target: 'http://localhost:3000', changeOrigin: true }, '/tgFather': { target: 'http://localhost:3000', changeOrigin: true }, '/tgLoginCodeLog': { target: 'http://localhost:3000', changeOrigin: true }, '/tgRegisterLog': { target: 'http://localhost:3000', changeOrigin: true }, '/register': { target: 'http://localhost:3000', changeOrigin: true }, '/smsPlatform': { target: 'http://localhost:3000', changeOrigin: true }, '/apiData': { target: 'http://localhost:3000', changeOrigin: true }, '/aiConfig': { target: 'http://localhost:3000', changeOrigin: true }, '/telegramUser': { target: 'http://localhost:3000', changeOrigin: true }, '/openApi': { target: 'http://localhost:3000', changeOrigin: true }, '/directMessageTask': { target: 'http://localhost:3000', changeOrigin: true }, '/messageTemplate': { target: 'http://localhost:3000', changeOrigin: true }, '/directMessageTarget': { target: 'http://localhost:3000', changeOrigin: true }, '/proxyPlatform': { target: 'http://localhost:3000', changeOrigin: true }, // Generic API fallback '/api': { target: 'http://localhost:3000', changeOrigin: true } } }, // Project deployment base // By default we assume your app will be deployed at the root of a domain, // e.g. https://www.my-app.com/ // If your app is deployed at a sub-path, you will need to specify that // sub-path here. For example, if your app is deployed at // https://www.foobar.com/my-app/ // then change this to '/my-app/' publicPath: BASE_URL, lintOnSave: false, chainWebpack: config => { config.resolve.alias .set('@', resolve('src')) // key,value自行定义,比如.set('@@', resolve('src/components')) .set('_c', resolve('src/components')) }, // 设为false打包时不生成.map文件 productionSourceMap: false // 这里写你调用接口的基础路径,来解决跨域,如果设置了代理,那你本地开发环境的axios的baseUrl要写为 '' ,即空字符串 // devServer: { // proxy: 'localhost:3000' // } }