Files
gofly-platform-services/zlt-web/yingyan/config/config.ts
T
2026-07-28 19:02:52 +08:00

49 lines
1.7 KiB
TypeScript

/**
* 鹰眼管控平台 - Umi配置
*/
import routes from './routes';
import proxy from './proxy';
const { REACT_APP_ENV } = process.env as any;
const isDev = process.env.NODE_ENV === 'development';
const API_PREFIX = isDev ? '' : (process.env.API_PREFIX || '');
const APP_BASE = isDev ? '/' : (process.env.APP_BASE || '/');
export default {
hash: true,
publicPath: isDev ? '/' : (APP_BASE.endsWith('/') ? APP_BASE : APP_BASE + '/'),
// 禁用 umi 的 antd 插件,Ant Design 5.x 由 app.tsx 中的 ConfigProvider 管理
antd: false,
title: '鹰眼管控平台',
metas: [
{ charset: 'utf-8' },
{ name: 'viewport', content: 'width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no' },
],
// Ant Design 5.x 使用 ConfigProvider 配置主题,不再使用 Less 变量
// 主题配置移至 app.tsx 中的 ConfigProvider
locale: { antd: false, default: 'zh-CN', baseNavigator: true },
dynamicImport: { loading: '@/components/PageLoading' },
routes,
history: { type: 'browser' },
base: APP_BASE,
proxy: (proxy as any)[REACT_APP_ENV || 'dev'],
define: {
'process.env.API_PREFIX': API_PREFIX,
'process.env.APP_BASE': APP_BASE,
},
nodeModulesTransform: { type: 'none' },
mfsu: false,
fastRefresh: {},
// Cesium 资源配置
chainWebpack: (config: any) => {
config.plugin('define').tap((definitions: any) => {
Object.assign(definitions[0], {
'process.env.CESIUM_BASE_URL': JSON.stringify(isDev ? '/' : (APP_BASE.endsWith('/') ? APP_BASE : APP_BASE + '/')),
'process.env.REACT_APP_CESIUM_TOKEN': JSON.stringify(process.env.REACT_APP_CESIUM_TOKEN || ''),
});
return definitions;
});
return config;
},
} as any;