const { defineConfig } = require('@vue/cli-service') module.exports = defineConfig({ // 部署应用时候的基本url publicPath: process.env.NODE_ENV === 'production' ? './' : '/', devServer: { proxy: { '/api': { target: 'http://btgym.xingtongworld.com/api/', // 配置访问的服务器地址 pathRewrite: { '^/api': '' }, // 用于将请求中的 /api 字符串替换为空, 然后访问地址就能正确访问,若不添加此行配置,那么访问地址就变成了: http://localhost:5000/api/request_url,这样的请求就会出现 404 操作 ws: true, // 是否支持 webstocket, 默认是 true changeOrigin: true // 用于控制请求头中的 host 值, 默认是 ture } }, // http 代理配置 // proxy: { // '/m': { // target: 'http://btgym.xingtongworld.com/', //目标接口域名 // changeOrigin: true, //是否跨域 // // logLevel: "debug", // pathRewrite: { // '^/m': '/api' // } // } // }, }, transpileDependencies: true, lintOnSave: false, publicPath: './' })