config.js 1.9KB

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