config.ts 1.6 KB

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