config.js 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  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 windicss from 'windicss-webpack-plugin/dist/index'
  7. const { REACT_APP_ENV } = process.env
  8. export default defineConfig({
  9. hash: true,
  10. antd: {},
  11. dva: {
  12. hmr: true
  13. },
  14. history: {
  15. type: 'browser'
  16. },
  17. locale: {
  18. // default zh-CN
  19. default: 'zh-CN',
  20. antd: false,
  21. // default true, when it is true, will use `navigator.language` overwrite default
  22. baseNavigator: false
  23. },
  24. dynamicImport: {
  25. loading: '@/components/PageLoading/index'
  26. },
  27. targets: {
  28. ie: 11
  29. },
  30. // umi routes: https://umijs.org/docs/routing
  31. routes,
  32. // Theme for antd: https://ant.design/docs/react/customize-theme-cn
  33. theme: {
  34. 'primary-color': defaultSettings.primaryColor
  35. },
  36. title: false,
  37. ignoreMomentLocale: true,
  38. proxy: proxy[REACT_APP_ENV || 'dev'],
  39. manifest: {
  40. basePath: '/'
  41. },
  42. exportStatic: {},
  43. esbuild: {},
  44. fastRefresh: {},
  45. extraBabelPlugins: [
  46. '@babel/plugin-proposal-nullish-coalescing-operator',
  47. '@babel/plugin-proposal-optional-chaining'
  48. ],
  49. chainWebpack(config) {
  50. config.plugin('windicss').use(windicss)
  51. }
  52. })