config.ts 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  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. access: {},
  37. // Theme for antd: https://ant.design/docs/react/customize-theme-cn
  38. theme: {
  39. // 如果不想要 configProvide 动态设置主题需要把这个设置为 default
  40. // 只有设置为 variable, 才能使用 configProvide 动态设置主色调
  41. // https://ant.design/docs/react/customize-theme-variable-cn
  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: { type: 'none' },
  70. mfsu: {},
  71. webpack5: {},
  72. exportStatic: {},
  73. });