config.ts 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. // https://umijs.org/config/
  2. import { defineConfig } from 'umi';
  3. import defaultSettings from './defaultSettings';
  4. import proxy from './proxy';
  5. import { gameDataStatistics } from './routerConfig';
  6. // const CompressionWebpackPlugin = require('compression-webpack-plugin');
  7. const { REACT_APP_ENV } = process.env;
  8. export default defineConfig({
  9. history: {
  10. type: 'hash',
  11. },
  12. // 默认是 browse
  13. hash: true,
  14. antd: {
  15. // dark: true
  16. // compact: true, // 开启紧凑主题
  17. },
  18. dva: {
  19. hmr: true,
  20. },
  21. layout: {
  22. name: '趣程管理后台',
  23. locale: false,
  24. siderWidth: 208,
  25. },
  26. locale: {
  27. // default zh-CN
  28. default: 'zh-CN',
  29. // default true, when it is true, will use `navigator.language` overwrite default
  30. antd: true,
  31. baseNavigator: true,
  32. },
  33. dynamicImport: {
  34. //按需加载组件
  35. loading: '@/components/PageLoading/index',
  36. },
  37. targets: {
  38. ie: 11,
  39. },
  40. // umi routes: https://umijs.org/docs/routing
  41. routes: [
  42. {
  43. path: '/user',
  44. layout: false,
  45. routes: [
  46. {
  47. name: 'login',
  48. path: '/user/login',
  49. component: './user/login',
  50. },
  51. ],
  52. },
  53. gameDataStatistics, // 游戏数据
  54. {
  55. path: '/',
  56. redirect: '/',
  57. },
  58. {
  59. component: './404',
  60. },
  61. ],
  62. // Theme for antd: https://ant.design/docs/react/customize-theme-cn
  63. theme: {
  64. // ...darkTheme,
  65. 'primary-color': defaultSettings.primaryColor,
  66. },
  67. // @ts-ignore
  68. title: false,
  69. ignoreMomentLocale: true,
  70. proxy: proxy[REACT_APP_ENV || 'dev'],
  71. manifest: {
  72. basePath: '/',
  73. },
  74. });