config.js 1.7KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. // https://umijs.org/config/
  2. import { defineConfig } from '@umijs/max';
  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: REACT_APP_ENV ? '' : ''
  11. },
  12. hash: true,
  13. antd: {
  14. dark: true,
  15. },
  16. request: {},
  17. initialState: {},
  18. model: {},
  19. layout: {
  20. // https://umijs.org/zh-CN/plugins/plugin-layout
  21. locale: false,
  22. siderWidth: 208,
  23. ...defaultSettings,
  24. },
  25. // https://umijs.org/zh-CN/plugins/plugin-locale
  26. locale: false,
  27. targets: {
  28. ie: 11,
  29. },
  30. // umi routes: https://umijs.org/docs/routing
  31. routes,
  32. access: {},
  33. // Theme for antd: https://ant.design/docs/react/customize-theme-cn
  34. theme: {
  35. // 如果不想要 configProvide 动态设置主题需要把这个设置为 default
  36. // 只有设置为 variable, 才能使用 configProvide 动态设置主色调
  37. // https://ant.design/docs/react/customize-theme-variable-cn
  38. 'root-entry-name': 'variable',
  39. },
  40. ignoreMomentLocale: true,
  41. proxy: proxy[REACT_APP_ENV || 'dev'],
  42. manifest: {
  43. basePath: '/',
  44. },
  45. // Fast Refresh 热更新
  46. fastRefresh: true,
  47. presets: ['umi-presets-pro'],
  48. openAPI: [
  49. {
  50. requestLibPath: "import { request } from '@umijs/max'",
  51. // 或者使用在线的版本
  52. // schemaPath: "https://gw.alipayobjects.com/os/antfincdn/M%24jrzTTYJN/oneapi.json"
  53. schemaPath: join(__dirname, 'oneapi.json'),
  54. mock: false,
  55. },
  56. {
  57. requestLibPath: "import { request } from '@umijs/max'",
  58. schemaPath: 'https://gw.alipayobjects.com/os/antfincdn/CA1dOm%2631B/openapi.json',
  59. projectName: 'swagger',
  60. },
  61. ],
  62. });