forked from umijs/umi
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.umirc.ts
156 lines (153 loc) · 3.64 KB
/
.umirc.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
// Config for dumi
import { defineConfig } from 'umi';
function getMenus(opts: { lang?: string; base: '/docs' | '/plugins' }) {
const menus = {
'/plugins': [
{
title: 'Presets',
children: ['/plugins/preset-react'],
},
{
title: 'Plugins',
children: [
'/plugins/plugin-access',
'/plugins/plugin-analytics',
'/plugins/plugin-antd',
'/plugins/plugin-crossorigin',
'/plugins/plugin-dva',
'/plugins/plugin-esbuild',
'/plugins/plugin-helmet',
'/plugins/plugin-initial-state',
'/plugins/plugin-layout',
'/plugins/plugin-locale',
'/plugins/plugin-model',
'/plugins/plugin-preact',
'/plugins/plugin-qiankun',
'/plugins/plugin-request',
'/plugins/plugin-sass',
],
},
{
title: 'Plugin Develop',
'title_zh-CN': '插件开发',
children: ['/plugins/api', '/plugins/best-practice'],
},
],
'/docs': [
{
title: 'VERSION 3.X',
children: [],
},
{
title: 'Introduce',
'title_zh-CN': '介绍',
children: [
'/docs/README',
'/docs/how-umi-works',
'/docs/getting-started',
],
},
{
title: 'Umi Basic',
'title_zh-CN': 'Umi 基础',
children: [
'/docs/directory-structure',
'/docs/config',
'/docs/runtime-config',
'/docs/routing',
'/docs/convention-routing',
'/docs/plugin',
'/docs/navigate-between-pages',
'/docs/html-template',
'/docs/mock',
'/docs/env-variables',
'/docs/cli',
],
},
{
title: 'Styles and Assets',
'title_zh-CN': '样式和资源文件',
children: ['/docs/assets-css', '/docs/assets-image'],
},
{
title: 'Umi Advanced',
'title_zh-CN': 'Umi 进阶',
children: [
'/docs/load-on-demand',
'/docs/fast-refresh',
'/docs/deployment',
'/docs/use-umi-ui',
'/docs/ssr',
'/docs/mfsu',
],
},
{
title: 'Upgrade to Umi 3',
'title_zh-CN': '升级到 Umi 3',
path: '/docs/upgrade-to-umi-3',
},
{
title: 'CONTRIBUTING',
'title_zh-CN': '贡献',
path: '/docs/contributing',
},
{
title: 'FAQ',
path: '/docs/faq',
},
],
};
return (menus[opts.base] as []).map((menu: any) => {
if (!opts.lang) return menu;
return {
...menu,
title: menu[`title_${opts.lang}`] || menu.title,
};
});
}
const isDev = process.env.NODE_ENV === 'development';
export default defineConfig({
...(isDev
? {
webpack5: {},
dynamicImport: {},
mfsu: {},
}
: {
ssr: {},
}),
favicon: 'https://img.alicdn.com/tfs/TB1YHEpwUT1gK0jSZFhXXaAtVXa-28-27.svg',
mode: 'site',
title: 'UmiJS',
resolve: {
includes: ['./docs'],
previewLangs: [],
},
menus: {
'/zh-CN/docs': getMenus({ lang: 'zh-CN', base: '/docs' }),
'/docs': getMenus({ base: '/docs' }),
'/zh-CN/plugins': getMenus({ lang: 'zh-CN', base: '/plugins' }),
'/plugins': getMenus({ base: '/plugins' }),
},
navs: [
null,
{
title: 'v2.x',
path: 'https://v2.umijs.org',
},
{
title: 'GitHub',
path: 'https://github.com/umijs/umi',
},
],
polyfill: false,
nodeModulesTransform: {
type: 'none',
},
exportStatic: {},
analytics: isDev
? false
: {
ga: 'UA-149864185-1',
},
});