12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  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. publicPath: '/w2/',
  13. hash: true,
  14. history: {
  15. type: 'hash'
  16. },
  17. antd: {
  18. dark: true,
  19. },
  20. request: {},
  21. initialState: {},
  22. model: {},
  23. layout: {
  24. // https://umijs.org/zh-CN/plugins/plugin-layout
  25. locale: false,
  26. siderWidth: 208,
  27. ...defaultSettings,
  28. },
  29. // https://umijs.org/zh-CN/plugins/plugin-locale
  30. locale: false,
  31. jsMinifier: 'terser',
  32. cssMinifier: 'cssnano',
  33. targets: {
  34. ie: 11,
  35. },
  36. // umi routes: https://umijs.org/docs/routing
  37. routes,
  38. access: {},
  39. // Theme for antd: https://ant.design/docs/react/customize-theme-cn
  40. theme: {
  41. // 如果不想要 configProvide 动态设置主题需要把这个设置为 default
  42. // 只有设置为 variable, 才能使用 configProvide 动态设置主色调
  43. // https://ant.design/docs/react/customize-theme-variable-cn
  44. 'root-entry-name': 'variable',
  45. },
  46. ignoreMomentLocale: true,
  47. proxy: proxy[REACT_APP_ENV || 'dev'],
  48. manifest: {
  49. basePath: '/',
  50. },
  51. // Fast Refresh 热更新
  52. fastRefresh: true,
  53. presets: ['umi-presets-pro'],
  54. openAPI: false,
  55. });