config.js 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. // https://umijs.org/config/
  2. import { defineConfig } from 'umi';
  3. import defaultSettings from './defaultSettings';
  4. import proxy from './proxy';
  5. const { REACT_APP_ENV } = process.env;
  6. export default defineConfig({
  7. hash: true,
  8. antd: {},
  9. dva: {
  10. hmr: true,
  11. },
  12. history: {
  13. type: 'browser',
  14. },
  15. locale: {
  16. // default zh-CN
  17. default: 'zh-CN',
  18. antd: true,
  19. // default true, when it is true, will use `navigator.language` overwrite default
  20. baseNavigator: true,
  21. },
  22. dynamicImport: {
  23. loading: '@/components/PageLoading/index',
  24. },
  25. targets: {
  26. ie: 11,
  27. },
  28. // umi routes: https://umijs.org/docs/routing
  29. routes: [
  30. {
  31. path: '/',
  32. component: '../layouts/BlankLayout',
  33. routes: [
  34. {
  35. path: '/user',
  36. component: '../layouts/UserLayout',
  37. routes: [
  38. {
  39. path: '/user/login',
  40. name: 'login',
  41. component: './User/login',
  42. },
  43. {
  44. path: '/user',
  45. redirect: '/user/login',
  46. },
  47. {
  48. name: 'register-result',
  49. icon: 'smile',
  50. path: '/user/register-result',
  51. component: './User/register-result',
  52. },
  53. {
  54. name: 'register',
  55. icon: 'smile',
  56. path: '/user/register',
  57. component: './User/register',
  58. },
  59. {
  60. component: '404',
  61. },
  62. ],
  63. },
  64. {
  65. path: '/',
  66. component: '../layouts/BasicLayout',
  67. Routes: ['src/pages/Authorized'],
  68. authority: ['admin', 'user'],
  69. routes: [
  70. {
  71. path: '/',
  72. redirect: '/dashboard/analysis',
  73. },
  74. {
  75. path: '/edit',
  76. name: 'edit',
  77. icon: 'edit',
  78. component: './edit',
  79. },
  80. {
  81. path: '/bugs',
  82. name: 'bugs',
  83. icon: 'BugOutlined',
  84. component: './bugs',
  85. },
  86. ],
  87. },
  88. ],
  89. },
  90. ],
  91. // Theme for antd: https://ant.design/docs/react/customize-theme-cn
  92. theme: {
  93. 'primary-color': defaultSettings.primaryColor,
  94. },
  95. title: false,
  96. ignoreMomentLocale: true,
  97. proxy: proxy[REACT_APP_ENV || 'dev'],
  98. manifest: {
  99. basePath: '/',
  100. },
  101. esbuild: {},
  102. });