修复页面bug
This commit is contained in:
@@ -8,11 +8,14 @@ import proxy from './proxy';
|
||||
|
||||
const { REACT_APP_ENV } = process.env as any;
|
||||
const isDev = process.env.NODE_ENV === 'development';
|
||||
// 构建期注入 API 前缀(生产包/测试包/预发包),开发环境走代理不加前缀
|
||||
const API_PREFIX = isDev ? '' : (process.env.API_PREFIX || '');
|
||||
const APP_BASE = isDev ? '/' : (process.env.APP_BASE || '/');
|
||||
|
||||
export default {
|
||||
hash: true,
|
||||
// 资源路径:开发用根路径,生产为相对路径
|
||||
publicPath: isDev ? '/' : './',
|
||||
publicPath: isDev ? '/' : (APP_BASE.endsWith('/') ? APP_BASE : APP_BASE + '/'),
|
||||
antd: {},
|
||||
// 页面 meta 标签
|
||||
metas: [
|
||||
@@ -36,8 +39,14 @@ export default {
|
||||
routes,
|
||||
// 历史模式
|
||||
history: { type: 'browser' },
|
||||
base: APP_BASE,
|
||||
// Dev 代理
|
||||
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,
|
||||
|
||||
Reference in New Issue
Block a user