config.ts 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320
  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. const { REACT_APP_ENV } = process.env;
  7. export default defineConfig({
  8. hash: true,
  9. antd: {},
  10. dva: {
  11. hmr: true,
  12. },
  13. layout: {
  14. // https://umijs.org/zh-CN/plugins/plugin-layout
  15. locale: true,
  16. siderWidth: 208,
  17. ...defaultSettings,
  18. },
  19. // https://umijs.org/zh-CN/plugins/plugin-locale
  20. locale: {
  21. // default zh-CN
  22. default: 'zh-CN',
  23. antd: true,
  24. // default true, when it is true, will use `navigator.language` overwrite default
  25. baseNavigator: true,
  26. },
  27. dynamicImport: {
  28. loading: '@ant-design/pro-layout/es/PageLoading',
  29. },
  30. targets: {
  31. ie: 11,
  32. },
  33. // umi routes: https://umijs.org/docs/routing
  34. routes: [
  35. {
  36. path: '/user',
  37. layout: false,
  38. routes: [
  39. {
  40. path: '/user/login',
  41. layout: false,
  42. name: 'login',
  43. component: './User/Login',
  44. },
  45. {
  46. path: '/user',
  47. redirect: '/user/login',
  48. },
  49. {
  50. name: 'register.result',
  51. icon: 'smile',
  52. path: '/user/register-result',
  53. component: './user/register-result',
  54. },
  55. {
  56. name: 'register',
  57. icon: 'smile',
  58. path: '/user/register',
  59. component: './user/register',
  60. },
  61. {
  62. component: '404',
  63. },
  64. ],
  65. },
  66. {
  67. path: '/dashboard',
  68. name: 'dashboard',
  69. icon: 'dashboard',
  70. routes: [
  71. {
  72. name: 'analysis',
  73. icon: 'smile',
  74. path: '/dashboard/analysis',
  75. component: './dashboard/analysis',
  76. },
  77. {
  78. name: 'monitor',
  79. icon: 'smile',
  80. path: '/dashboard/monitor',
  81. component: './dashboard/monitor',
  82. },
  83. {
  84. name: 'workplace',
  85. icon: 'smile',
  86. path: '/dashboard/workplace',
  87. component: './dashboard/workplace',
  88. },
  89. ],
  90. },
  91. {
  92. path: '/form',
  93. icon: 'form',
  94. name: 'form',
  95. routes: [
  96. {
  97. name: 'basic-form',
  98. icon: 'smile',
  99. path: '/form/basic-form',
  100. component: './form/basic-form',
  101. },
  102. {
  103. name: 'step-form',
  104. icon: 'smile',
  105. path: '/form/step-form',
  106. component: './form/step-form',
  107. },
  108. {
  109. name: 'advanced-form',
  110. icon: 'smile',
  111. path: '/form/advanced-form',
  112. component: './form/advanced-form',
  113. },
  114. ],
  115. },
  116. {
  117. path: '/list',
  118. icon: 'table',
  119. name: 'list',
  120. routes: [
  121. {
  122. path: '/list/search',
  123. name: 'search-list',
  124. component: './list/search',
  125. routes: [
  126. {
  127. path: '/list/search',
  128. redirect: '/list/search/articles',
  129. },
  130. {
  131. name: 'articles',
  132. icon: 'smile',
  133. path: '/list/search/articles',
  134. component: './list/search/articles',
  135. },
  136. {
  137. name: 'projects',
  138. icon: 'smile',
  139. path: '/list/search/projects',
  140. component: './list/search/projects',
  141. },
  142. {
  143. name: 'applications',
  144. icon: 'smile',
  145. path: '/list/search/applications',
  146. component: './list/search/applications',
  147. },
  148. ],
  149. },
  150. {
  151. name: 'table-list',
  152. icon: 'smile',
  153. path: '/list/table-list',
  154. component: './list/table-list',
  155. },
  156. {
  157. name: 'basic-list',
  158. icon: 'smile',
  159. path: '/list/basic-list',
  160. component: './list/basic-list',
  161. },
  162. {
  163. name: 'card-list',
  164. icon: 'smile',
  165. path: '/list/card-list',
  166. component: './list/card-list',
  167. },
  168. ],
  169. },
  170. {
  171. path: '/profile',
  172. name: 'profile',
  173. icon: 'profile',
  174. routes: [
  175. {
  176. name: 'basic',
  177. icon: 'smile',
  178. path: '/profile/basic',
  179. component: './profile/basic',
  180. },
  181. {
  182. name: 'advanced',
  183. icon: 'smile',
  184. path: '/profile/advanced',
  185. component: './profile/advanced',
  186. },
  187. ],
  188. },
  189. {
  190. name: 'result',
  191. icon: 'CheckCircleOutlined',
  192. path: '/result',
  193. routes: [
  194. {
  195. name: 'success',
  196. icon: 'smile',
  197. path: '/result/success',
  198. component: './result/success',
  199. },
  200. {
  201. name: 'fail',
  202. icon: 'smile',
  203. path: '/result/fail',
  204. component: './result/fail',
  205. },
  206. ],
  207. },
  208. {
  209. name: 'exception',
  210. icon: 'warning',
  211. path: '/exception',
  212. routes: [
  213. {
  214. name: '403',
  215. icon: 'smile',
  216. path: '/exception/403',
  217. component: './exception/403',
  218. },
  219. {
  220. name: '404',
  221. icon: 'smile',
  222. path: '/exception/404',
  223. component: './exception/404',
  224. },
  225. {
  226. name: '500',
  227. icon: 'smile',
  228. path: '/exception/500',
  229. component: './exception/500',
  230. },
  231. ],
  232. },
  233. {
  234. name: 'account',
  235. icon: 'user',
  236. path: '/account',
  237. routes: [
  238. {
  239. name: 'center',
  240. icon: 'smile',
  241. path: '/account/center',
  242. component: './account/center',
  243. },
  244. {
  245. name: 'settings',
  246. icon: 'smile',
  247. path: '/account/settings',
  248. component: './account/settings',
  249. },
  250. ],
  251. },
  252. {
  253. name: 'editor',
  254. icon: 'highlight',
  255. path: '/editor',
  256. routes: [
  257. {
  258. name: 'flow',
  259. icon: 'smile',
  260. path: '/editor/flow',
  261. component: './editor/flow',
  262. },
  263. {
  264. name: 'mind',
  265. icon: 'smile',
  266. path: '/editor/mind',
  267. component: './editor/mind',
  268. },
  269. {
  270. name: 'koni',
  271. icon: 'smile',
  272. path: '/editor/koni',
  273. component: './editor/koni',
  274. },
  275. ],
  276. },
  277. {
  278. path: '/',
  279. redirect: '/dashboard/analysis',
  280. },
  281. {
  282. component: '404',
  283. },
  284. ],
  285. // Theme for antd: https://ant.design/docs/react/customize-theme-cn
  286. theme: {
  287. 'primary-color': defaultSettings.primaryColor,
  288. },
  289. // esbuild is father build tools
  290. // https://umijs.org/plugins/plugin-esbuild
  291. esbuild: {},
  292. title: false,
  293. ignoreMomentLocale: true,
  294. proxy: proxy[REACT_APP_ENV || 'dev'],
  295. manifest: {
  296. basePath: '/',
  297. },
  298. // Fast Refresh 热更新
  299. fastRefresh: {},
  300. openAPI: [
  301. {
  302. requestLibPath: "import { request } from 'umi'",
  303. // 或者使用在线的版本
  304. // schemaPath: "https://gw.alipayobjects.com/os/antfincdn/M%24jrzTTYJN/oneapi.json"
  305. schemaPath: join(__dirname, 'oneapi.json'),
  306. mock: false,
  307. },
  308. {
  309. requestLibPath: "import { request } from 'umi'",
  310. schemaPath: 'https://gw.alipayobjects.com/os/antfincdn/CA1dOm%2631B/openapi.json',
  311. projectName: 'swagger',
  312. },
  313. ],
  314. nodeModulesTransform: {
  315. type: 'none',
  316. },
  317. mfsu: {},
  318. webpack5: {},
  319. exportStatic: {},
  320. });