config.ts 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. // https://umijs.org/config/
  2. import { defineConfig } from 'umi'
  3. import { join } from 'path'
  4. import defaultSettings from './defaultSettings'
  5. import proxy from './proxy'
  6. import routes from './routes'
  7. const { REACT_APP_ENV } = process.env
  8. export default defineConfig({
  9. hash: true,
  10. antd: {},
  11. dva: {
  12. hmr: true
  13. },
  14. layout: {
  15. // https://umijs.org/zh-CN/plugins/plugin-layout
  16. locale: true,
  17. siderWidth: 208,
  18. ...defaultSettings
  19. },
  20. // https://umijs.org/zh-CN/plugins/plugin-locale
  21. locale: {
  22. // default zh-CN
  23. default: 'zh-CN',
  24. antd: true,
  25. // default true, when it is true, will use `navigator.language` overwrite default
  26. baseNavigator: true
  27. },
  28. dynamicImport: {
  29. loading: '@ant-design/pro-layout/es/PageLoading'
  30. },
  31. targets: {
  32. ie: 11
  33. },
  34. // umi routes: https://umijs.org/docs/routing
  35. routes,
  36. // Theme for antd: https://ant.design/docs/react/customize-theme-cn
  37. theme: {
  38. 'primary-color': defaultSettings.primaryColor
  39. },
  40. // esbuild is father build tools
  41. // https://umijs.org/plugins/plugin-esbuild
  42. esbuild: {},
  43. title: false,
  44. ignoreMomentLocale: true,
  45. proxy: proxy[REACT_APP_ENV || 'dev'],
  46. manifest: {
  47. basePath: '/'
  48. },
  49. // Fast Refresh 热更新
  50. fastRefresh: {},
  51. inspectorConfig: {
  52. babelPlugins: [
  53. [
  54. 'import',
  55. {
  56. libraryName: '@icon-park/react',
  57. libraryDirectory: 'es/icons',
  58. camel2DashComponentName: false
  59. }
  60. ]
  61. ]
  62. }
  63. })