Skip to content

Commit

Permalink
⚡️ performance: open esbuild
Browse files Browse the repository at this point in the history
  • Loading branch information
chenshuai2144 committed Nov 5, 2020
1 parent b17bf99 commit f68066a
Show file tree
Hide file tree
Showing 3 changed files with 79 additions and 73 deletions.
76 changes: 7 additions & 69 deletions config/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import { defineConfig } from 'umi';
import defaultSettings from './defaultSettings';
import proxy from './proxy';
import routes from './routes';

const { REACT_APP_ENV } = process.env;

Expand All @@ -11,6 +12,9 @@ export default defineConfig({
dva: {
hmr: true,
},
history: {
type: 'browser',
},
locale: {
// default zh-CN
default: 'zh-CN',
Expand All @@ -25,83 +29,17 @@ export default defineConfig({
ie: 11,
},
// umi routes: https://umijs.org/docs/routing
routes: [
{
path: '/user',
component: '../layouts/UserLayout',
routes: [
{
name: 'login',
path: '/user/login',
component: './user/login',
},
],
},
{
path: '/',
component: '../layouts/SecurityLayout',
routes: [
{
path: '/',
component: '../layouts/BasicLayout',
authority: ['admin', 'user'],
routes: [
{
path: '/',
redirect: '/welcome',
},
{
path: '/welcome',
name: 'welcome',
icon: 'smile',
component: './Welcome',
},
{
path: '/admin',
name: 'admin',
icon: 'crown',
component: './Admin',
authority: ['admin'],
routes: [
{
path: '/admin/sub-page',
name: 'sub-page',
icon: 'smile',
component: './Welcome',
authority: ['admin'],
},
],
},
{
name: 'list.table-list',
icon: 'table',
path: '/list',
component: './ListTableList',
},
{
component: './404',
},
],
},
{
component: './404',
},
],
},
{
component: './404',
},
],
routes,
// Theme for antd: https://ant.design/docs/react/customize-theme-cn
theme: {
// ...darkTheme,
'primary-color': defaultSettings.primaryColor,
},
// @ts-ignore
title: false,
ignoreMomentLocale: true,
proxy: proxy[REACT_APP_ENV || 'dev'],
manifest: {
basePath: '/',
},
exportStatic: {},
esbuild: {},
});
67 changes: 67 additions & 0 deletions config/routes.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
export default [
{
path: '/user',
component: '../layouts/UserLayout',
routes: [
{
name: 'login',
path: '/user/login',
component: './user/login',
},
],
},
{
path: '/',
component: '../layouts/SecurityLayout',
routes: [
{
path: '/',
component: '../layouts/BasicLayout',
authority: ['admin', 'user'],
routes: [
{
path: '/',
redirect: '/welcome',
},
{
path: '/welcome',
name: 'welcome',
icon: 'smile',
component: './Welcome',
},
{
path: '/admin',
name: 'admin',
icon: 'crown',
component: './Admin',
authority: ['admin'],
routes: [
{
path: '/admin/sub-page',
name: 'sub-page',
icon: 'smile',
component: './Welcome',
authority: ['admin'],
},
],
},
{
name: 'list.table-list',
icon: 'table',
path: '/list',
component: './ListTableList',
},
{
component: './404',
},
],
},
{
component: './404',
},
],
},
{
component: './404',
},
];
9 changes: 5 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,11 @@
"dependencies": {
"@ant-design/icons": "^4.0.0",
"@ant-design/pro-descriptions": "^1.0.19",
"@ant-design/pro-form": "^1.2.0",
"@ant-design/pro-layout": "^6.4.19",
"@ant-design/pro-table": "^2.9.5",
"@ant-design/pro-form": "^1.3.0",
"@ant-design/pro-layout": "^6.5.0",
"@ant-design/pro-table": "^2.9.16",
"@umijs/route-utils": "^1.0.33",
"antd": "^4.7.0",
"antd": "^4.8.0",
"classnames": "^2.2.6",
"lodash": "^4.17.11",
"moment": "^2.25.3",
Expand All @@ -85,6 +85,7 @@
"@types/react-helmet": "^6.1.0",
"@umijs/fabric": "^2.3.0",
"@umijs/plugin-blocks": "^2.0.5",
"@umijs/plugin-esbuild": "^1.0.1",
"@umijs/preset-ant-design-pro": "^1.2.0",
"@umijs/preset-react": "^1.4.8",
"@umijs/yorkie": "^2.0.3",
Expand Down

1 comment on commit f68066a

@afc163
Copy link
Member

@afc163 afc163 commented on f68066a Nov 11, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Please sign in to comment.