// Umi 3 基础配置(中文注释) // 目标: // - 显式启用 routes.ts(保持与原项目路径兼容,支持 *.html 路径) // - 使用 browser history,开发调试直达路径不 404;产物 publicPath 保持相对路径便于静态托管 // - 开发环境走 proxy 转发后端,避免跨域 import routes from './routes'; import proxy from './proxy'; const { REACT_APP_ENV } = process.env as any; const isDev = process.env.NODE_ENV === 'development'; export default { hash: true, // 资源路径:开发用根路径,生产为相对路径 publicPath: isDev ? '/' : './', antd: {}, // 页面 meta 标签 metas: [ { charset: 'utf-8' }, { name: 'viewport', content: 'width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no' }, ], // 主题(现代风格 + 红绿配主色) theme: { 'primary-color': '#ff4d4f', 'border-radius-base': '8px', 'box-shadow-base': '0 8px 32px rgba(0, 0, 0, 0.1)', 'animation-duration-slow': '0.4s', 'animation-duration-base': '0.3s', 'animation-duration-fast': '0.2s', }, // 关闭 i18n,多语言后续按需启用 locale: { antd: false, default: 'zh-CN', baseNavigator: true }, // 使用按需编译的动态导入,提升首屏 dynamicImport: { loading: '@/components/PageLoading' }, // 路由采用显式配置 routes, // 历史模式 history: { type: 'browser' }, // Dev 代理 proxy: (proxy as any)[REACT_APP_ENV || 'dev'], // 构建优化 nodeModulesTransform: { type: 'none' }, mfsu: false, fastRefresh: {}, } as any;