config.js 2.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  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. const { REACT_APP_ENV } = process.env;
  8. export default defineConfig({
  9. mfsu: {},
  10. webpack5: {},
  11. define: {
  12. API_BASE: 'http://invoice-filling.stategrid.njyunzhi.com',
  13. H5_URL: 'http://h5.njyunzhi.com/state-grid/invoice-filling-h5/index.html',
  14. MODEL_URL:
  15. 'https://h5.njyunzhi.com/assets/%E6%8A%A5%E9%94%80%E4%BA%BA%E5%91%98%E6%A8%A1%E6%9D%BF.xlsx',
  16. },
  17. base: '/', // 路由跳转必须加 admin
  18. publicPath: './', // 静态文件相对路径
  19. hash: true,
  20. history: {
  21. type: 'hash',
  22. },
  23. antd: {},
  24. dva: {
  25. hmr: true,
  26. },
  27. layout: {
  28. // https://umijs.org/zh-CN/plugins/plugin-layout
  29. locale: false,
  30. siderWidth: 208,
  31. ...defaultSettings,
  32. },
  33. // https://umijs.org/zh-CN/plugins/plugin-locale
  34. locale: {
  35. // default zh-CN
  36. default: 'zh-CN',
  37. antd: true,
  38. // default true, when it is true, will use `navigator.language` overwrite default
  39. baseNavigator: true,
  40. },
  41. dynamicImport: {
  42. loading: '@ant-design/pro-layout/es/PageLoading',
  43. },
  44. targets: {
  45. ie: 11,
  46. },
  47. // umi routes: https://umijs.org/docs/routing
  48. routes,
  49. // Theme for antd: https://ant.design/docs/react/customize-theme-cn
  50. theme: {
  51. 'root-entry-name': 'variable',
  52. },
  53. // esbuild is father build tools
  54. // https://umijs.org/plugins/plugin-esbuild
  55. esbuild: {},
  56. title: false,
  57. ignoreMomentLocale: true,
  58. proxy: proxy[REACT_APP_ENV || 'dev'],
  59. manifest: {
  60. basePath: '/',
  61. },
  62. // Fast Refresh 热更新
  63. fastRefresh: {},
  64. openAPI: [
  65. {
  66. requestLibPath: "import { request } from 'umi'",
  67. // 或者使用在线的版本
  68. // schemaPath: "https://gw.alipayobjects.com/os/antfincdn/M%24jrzTTYJN/oneapi.json"
  69. schemaPath: join(__dirname, 'oneapi.json'),
  70. mock: false,
  71. },
  72. {
  73. requestLibPath: "import { request } from 'umi'",
  74. schemaPath: 'https://gw.alipayobjects.com/os/antfincdn/CA1dOm%2631B/openapi.json',
  75. projectName: 'swagger',
  76. },
  77. ],
  78. nodeModulesTransform: {
  79. type: 'none',
  80. },
  81. exportStatic: {},
  82. });