config.js 1.9KB

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