config.js 1.8KB

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