config.ts 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  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. extraBabelPlugins: [
  55. ['babel-plugin-import', { libraryName: 'antd', libraryDirectory: 'es', style: true }, 'antd'],
  56. [
  57. 'babel-plugin-import',
  58. { libraryName: '@formily/antd', libraryDirectory: 'esm', style: true },
  59. '@formily/antd'
  60. ]
  61. ],
  62. // Fast Refresh 热更新
  63. fastRefresh: {},
  64. nodeModulesTransform: { type: 'none' },
  65. // mfsu: {},
  66. // webpack5: {},
  67. exportStatic: {}
  68. })