添加global

This commit is contained in:
limengnan 2026-03-26 13:51:39 +08:00
parent 346ec6288d
commit 2800d02243

View File

@ -17,6 +17,10 @@ export default ({ mode }: ConfigEnv): UserConfig => {
symbolId: 'icon-[dir]-[name]' symbolId: 'icon-[dir]-[name]'
}) })
], ],
define: {
// 为所有模块注入 global 变量
global: 'window'
},
// 本地反向代理解决浏览器跨域限制 // 本地反向代理解决浏览器跨域限制
server: { server: {
host: '0.0.0.0', host: '0.0.0.0',
@ -27,7 +31,7 @@ export default ({ mode }: ConfigEnv): UserConfig => {
// 线上API地址 // 线上API地址
// target: 'http://192.168.1.166:8090/', // target: 'http://192.168.1.166:8090/',
// 本地API地址 // 本地API地址
target: 'http://localhost:8090', target: 'http://192.168.1.76:8090',
changeOrigin: true, changeOrigin: true,
rewrite: path => rewrite: path =>
path.replace(new RegExp('^' + env.VITE_APP_BASE_API), '') path.replace(new RegExp('^' + env.VITE_APP_BASE_API), '')