config.js 1.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. // https://umijs.org/config/
  2. import { defineConfig } from 'umi';
  3. import { join, resolve } 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. history: { type: 'hash' },
  10. hash: true,
  11. antd: {},
  12. dva: {
  13. hmr: true,
  14. },
  15. alias: {
  16. '@': resolve('src'),
  17. },
  18. layout: {
  19. // https://umijs.org/zh-CN/plugins/plugin-layout
  20. locale: true,
  21. siderWidth: 208,
  22. ...defaultSettings,
  23. },
  24. // https://umijs.org/zh-CN/plugins/plugin-locale
  25. locale: {
  26. // default zh-CN
  27. default: 'zh-CN',
  28. antd: true,
  29. // default true, when it is true, will use `navigator.language` overwrite default
  30. baseNavigator: true,
  31. },
  32. dynamicImport: {
  33. loading: '@ant-design/pro-layout/es/PageLoading',
  34. },
  35. targets: {
  36. ie: 11,
  37. },
  38. // umi routes: https://umijs.org/docs/routing
  39. routes,
  40. // Theme for antd: https://ant.design/docs/react/customize-theme-cn
  41. theme: {
  42. 'root-entry-name': 'variable',
  43. },
  44. // esbuild is father build tools
  45. // https://umijs.org/plugins/plugin-esbuild
  46. esbuild: {},
  47. title: false,
  48. ignoreMomentLocale: true,
  49. proxy: proxy[REACT_APP_ENV || 'dev'],
  50. manifest: {
  51. basePath: '/',
  52. },
  53. // Fast Refresh 热更新
  54. fastRefresh: {},
  55. openAPI: [
  56. {
  57. requestLibPath: "import { request } from 'umi'",
  58. // 或者使用在线的版本
  59. // schemaPath: "https://gw.alipayobjects.com/os/antfincdn/M%24jrzTTYJN/oneapi.json"
  60. schemaPath: join(__dirname, 'oneapi.json'),
  61. mock: false,
  62. },
  63. {
  64. requestLibPath: "import { request } from 'umi'",
  65. schemaPath: 'https://gw.alipayobjects.com/os/antfincdn/CA1dOm%2631B/openapi.json',
  66. projectName: 'swagger',
  67. },
  68. ],
  69. nodeModulesTransform: {
  70. type: 'none',
  71. },
  72. mfsu: {},
  73. webpack5: {},
  74. exportStatic: {},
  75. });