Skip to content

Commit f68066a

Browse files
committed
⚡️ performance: open esbuild
1 parent b17bf99 commit f68066a

File tree

3 files changed

+79
-73
lines changed

3 files changed

+79
-73
lines changed

Diff for: config/config.ts

+7-69
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
import { defineConfig } from 'umi';
33
import defaultSettings from './defaultSettings';
44
import proxy from './proxy';
5+
import routes from './routes';
56

67
const { REACT_APP_ENV } = process.env;
78

@@ -11,6 +12,9 @@ export default defineConfig({
1112
dva: {
1213
hmr: true,
1314
},
15+
history: {
16+
type: 'browser',
17+
},
1418
locale: {
1519
// default zh-CN
1620
default: 'zh-CN',
@@ -25,83 +29,17 @@ export default defineConfig({
2529
ie: 11,
2630
},
2731
// umi routes: https://umijs.org/docs/routing
28-
routes: [
29-
{
30-
path: '/user',
31-
component: '../layouts/UserLayout',
32-
routes: [
33-
{
34-
name: 'login',
35-
path: '/user/login',
36-
component: './user/login',
37-
},
38-
],
39-
},
40-
{
41-
path: '/',
42-
component: '../layouts/SecurityLayout',
43-
routes: [
44-
{
45-
path: '/',
46-
component: '../layouts/BasicLayout',
47-
authority: ['admin', 'user'],
48-
routes: [
49-
{
50-
path: '/',
51-
redirect: '/welcome',
52-
},
53-
{
54-
path: '/welcome',
55-
name: 'welcome',
56-
icon: 'smile',
57-
component: './Welcome',
58-
},
59-
{
60-
path: '/admin',
61-
name: 'admin',
62-
icon: 'crown',
63-
component: './Admin',
64-
authority: ['admin'],
65-
routes: [
66-
{
67-
path: '/admin/sub-page',
68-
name: 'sub-page',
69-
icon: 'smile',
70-
component: './Welcome',
71-
authority: ['admin'],
72-
},
73-
],
74-
},
75-
{
76-
name: 'list.table-list',
77-
icon: 'table',
78-
path: '/list',
79-
component: './ListTableList',
80-
},
81-
{
82-
component: './404',
83-
},
84-
],
85-
},
86-
{
87-
component: './404',
88-
},
89-
],
90-
},
91-
{
92-
component: './404',
93-
},
94-
],
32+
routes,
9533
// Theme for antd: https://ant.design/docs/react/customize-theme-cn
9634
theme: {
97-
// ...darkTheme,
9835
'primary-color': defaultSettings.primaryColor,
9936
},
100-
// @ts-ignore
10137
title: false,
10238
ignoreMomentLocale: true,
10339
proxy: proxy[REACT_APP_ENV || 'dev'],
10440
manifest: {
10541
basePath: '/',
10642
},
43+
exportStatic: {},
44+
esbuild: {},
10745
});

Diff for: config/routes.ts

+67
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
export default [
2+
{
3+
path: '/user',
4+
component: '../layouts/UserLayout',
5+
routes: [
6+
{
7+
name: 'login',
8+
path: '/user/login',
9+
component: './user/login',
10+
},
11+
],
12+
},
13+
{
14+
path: '/',
15+
component: '../layouts/SecurityLayout',
16+
routes: [
17+
{
18+
path: '/',
19+
component: '../layouts/BasicLayout',
20+
authority: ['admin', 'user'],
21+
routes: [
22+
{
23+
path: '/',
24+
redirect: '/welcome',
25+
},
26+
{
27+
path: '/welcome',
28+
name: 'welcome',
29+
icon: 'smile',
30+
component: './Welcome',
31+
},
32+
{
33+
path: '/admin',
34+
name: 'admin',
35+
icon: 'crown',
36+
component: './Admin',
37+
authority: ['admin'],
38+
routes: [
39+
{
40+
path: '/admin/sub-page',
41+
name: 'sub-page',
42+
icon: 'smile',
43+
component: './Welcome',
44+
authority: ['admin'],
45+
},
46+
],
47+
},
48+
{
49+
name: 'list.table-list',
50+
icon: 'table',
51+
path: '/list',
52+
component: './ListTableList',
53+
},
54+
{
55+
component: './404',
56+
},
57+
],
58+
},
59+
{
60+
component: './404',
61+
},
62+
],
63+
},
64+
{
65+
component: './404',
66+
},
67+
];

Diff for: package.json

+5-4
Original file line numberDiff line numberDiff line change
@@ -55,11 +55,11 @@
5555
"dependencies": {
5656
"@ant-design/icons": "^4.0.0",
5757
"@ant-design/pro-descriptions": "^1.0.19",
58-
"@ant-design/pro-form": "^1.2.0",
59-
"@ant-design/pro-layout": "^6.4.19",
60-
"@ant-design/pro-table": "^2.9.5",
58+
"@ant-design/pro-form": "^1.3.0",
59+
"@ant-design/pro-layout": "^6.5.0",
60+
"@ant-design/pro-table": "^2.9.16",
6161
"@umijs/route-utils": "^1.0.33",
62-
"antd": "^4.7.0",
62+
"antd": "^4.8.0",
6363
"classnames": "^2.2.6",
6464
"lodash": "^4.17.11",
6565
"moment": "^2.25.3",
@@ -85,6 +85,7 @@
8585
"@types/react-helmet": "^6.1.0",
8686
"@umijs/fabric": "^2.3.0",
8787
"@umijs/plugin-blocks": "^2.0.5",
88+
"@umijs/plugin-esbuild": "^1.0.1",
8889
"@umijs/preset-ant-design-pro": "^1.2.0",
8990
"@umijs/preset-react": "^1.4.8",
9091
"@umijs/yorkie": "^2.0.3",

0 commit comments

Comments
 (0)