config.ts 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  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. // define: {
  74. // 'process.env': {
  75. // REACT_APP_ENV: 'production', // 设置生产环境变量
  76. // },
  77. // },
  78. });