config.ts 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  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. import WindiCSSPlugin from 'windicss-webpack-plugin'
  8. const { REACT_APP_ENV } = process.env
  9. export default defineConfig({
  10. hash: true,
  11. antd: {},
  12. dva: {
  13. hmr: true
  14. },
  15. layout: {
  16. // https://umijs.org/zh-CN/plugins/plugin-layout
  17. locale: true,
  18. siderWidth: 208,
  19. ...defaultSettings
  20. },
  21. // https://umijs.org/zh-CN/plugins/plugin-locale
  22. locale: {
  23. // default zh-CN
  24. default: 'zh-CN',
  25. antd: true,
  26. // default true, when it is true, will use `navigator.language` overwrite default
  27. baseNavigator: true
  28. },
  29. dynamicImport: {
  30. loading: '@ant-design/pro-layout/es/PageLoading'
  31. },
  32. targets: {
  33. ie: 11
  34. },
  35. // request: { dataField: 'data' },
  36. // umi routes: https://umijs.org/docs/routing
  37. routes,
  38. // Theme for antd: https://ant.design/docs/react/customize-theme-cn
  39. theme: {
  40. 'primary-color': defaultSettings.primaryColor
  41. },
  42. // esbuild is father build tools
  43. // https://umijs.org/plugins/plugin-esbuild
  44. esbuild: {},
  45. title: false,
  46. ignoreMomentLocale: true,
  47. proxy: proxy[REACT_APP_ENV || 'dev'],
  48. manifest: {
  49. basePath: '/'
  50. },
  51. chainWebpack(config) {
  52. config.plugin('windicss').use(WindiCSSPlugin)
  53. },
  54. // Fast Refresh 热更新
  55. fastRefresh: {}
  56. })