config.ts 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  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. // let envValus = REACT_APP_ENV.split('-');
  9. // let env = envValus[0];
  10. console.log('env', REACT_APP_ENV);
  11. //debugger;
  12. export default defineConfig({
  13. hash: true,
  14. antd: {},
  15. dva: {
  16. hmr: true,
  17. },
  18. // layout: {
  19. // // https://umijs.org/zh-CN/plugins/plugin-layout
  20. // locale: true,
  21. // siderWidth: 208,
  22. // ...defaultSettings,
  23. // },
  24. layout: false,
  25. // https://umijs.org/zh-CN/plugins/plugin-locale
  26. locale: {
  27. // default zh-CN
  28. default: 'zh-CN',
  29. antd: true,
  30. // default true, when it is true, will use `navigator.language` overwrite default
  31. baseNavigator: true,
  32. },
  33. dynamicImport: {
  34. loading: '@ant-design/pro-layout/es/PageLoading',
  35. },
  36. targets: {
  37. ie: 11,
  38. },
  39. // umi routes: https://umijs.org/docs/routing
  40. routes,
  41. // Theme for antd: https://ant.design/docs/react/customize-theme-cn
  42. theme: {
  43. 'root-entry-name': 'variable',
  44. },
  45. // esbuild is father build tools
  46. // https://umijs.org/plugins/plugin-esbuild
  47. esbuild: {},
  48. title: false,
  49. ignoreMomentLocale: true,
  50. base: '/sgadmin/',
  51. publicPath: REACT_APP_ENV === 'pro' ? '/sgadmin/' : '/',
  52. outputPath: 'dist/sgadmin',
  53. proxy: proxy[REACT_APP_ENV || 'dev'],
  54. manifest: {
  55. basePath: '/sgadmin',
  56. },
  57. // Fast Refresh 热更新
  58. fastRefresh: {},
  59. openAPI: [
  60. {
  61. requestLibPath: "import { request } from 'umi'",
  62. // 或者使用在线的版本
  63. // schemaPath: "https://gw.alipayobjects.com/os/antfincdn/M%24jrzTTYJN/oneapi.json"
  64. schemaPath: join(__dirname, 'oneapi.json'),
  65. mock: false,
  66. },
  67. {
  68. requestLibPath: "import { request } from 'umi'",
  69. schemaPath: 'https://gw.alipayobjects.com/os/antfincdn/CA1dOm%2631B/openapi.json',
  70. projectName: 'swagger',
  71. },
  72. ],
  73. nodeModulesTransform: { type: 'none' },
  74. mfsu: {},
  75. webpack5: {},
  76. exportStatic: {},
  77. });