generated from tony19/vite-docs-template
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfig.ts
310 lines (295 loc) · 8.23 KB
/
config.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
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
import { defineConfig, DefaultTheme } from 'vitepress'
const ogDescription = 'Công cụ Frontend thế hệ tiếp theo'
const ogImage = 'https://vitejs.dev/og-image.png'
const ogTitle = 'Vite'
const ogUrl = 'https://vitejs.dev'
// netlify envs
const deployURL = process.env.DEPLOY_PRIME_URL || ''
const commitRef = process.env.COMMIT_REF?.slice(0, 8) || 'dev'
const deployType = (() => {
switch (deployURL) {
case 'https://main--vite-docs-main.netlify.app':
return 'main'
case '':
return 'local'
default:
return 'release'
}
})()
const additionalTitle = ((): string => {
switch (deployType) {
case 'main':
return ' (main branch)'
case 'local':
return ' (local)'
case 'release':
return ''
}
})()
const versionLinks = ((): DefaultTheme.NavItemWithLink[] => {
switch (deployType) {
case 'main':
case 'local':
return [
{
text: 'Tài liệu Vite 4 (phát hành)',
link: 'https://vitejs.dev',
},
{
text: 'Tài liệu Vite 3',
link: 'https://v3.vitejs.dev',
},
{
text: 'Tài liệu Vite 2',
link: 'https://v2.vitejs.dev',
},
]
case 'release':
return [
{
text: 'Tài liệu Vite 3',
link: 'https://v3.vitejs.dev',
},
{
text: 'Tài liệu Vite 2',
link: 'https://v2.vitejs.dev',
},
]
}
})()
export default defineConfig({
title: `Vite${additionalTitle}`,
description: 'Next Generation Frontend Tooling',
head: [
['link', { rel: 'icon', type: 'image/svg+xml', href: '/logo.svg' }],
['meta', { property: 'og:type', content: 'website' }],
['meta', { property: 'og:title', content: ogTitle }],
['meta', { property: 'og:image', content: ogImage }],
['meta', { property: 'og:url', content: ogUrl }],
['meta', { property: 'og:description', content: ogDescription }],
['meta', { name: 'twitter:card', content: 'summary_large_image' }],
['meta', { name: 'twitter:site', content: '@vite_js' }],
['meta', { name: 'theme-color', content: '#646cff' }],
[
'script',
{
src: 'https://cdn.usefathom.com/script.js',
'data-site': 'CBDFBSLI',
'data-spa': 'auto',
defer: '',
},
],
],
locales: {
root: { label: 'English' },
zh: { label: '简体中文', link: 'https://cn.vitejs.dev' },
ja: { label: '日本語', link: 'https://ja.vitejs.dev' },
es: { label: 'Español', link: 'https://es.vitejs.dev' },
pt: { label: 'Português', link: 'https://pt.vitejs.dev' },
},
vue: {
reactivityTransform: true,
},
themeConfig: {
logo: '/logo.svg',
editLink: {
pattern: 'https://github.com/vitejs/vite/edit/main/docs/:path',
text: 'Đề xuất thay đổi cho trang này',
},
socialLinks: [
{ icon: 'mastodon', link: 'https://elk.zone/m.webtoo.ls/@vite' },
{ icon: 'twitter', link: 'https://twitter.com/vite_js' },
{ icon: 'discord', link: 'https://chat.vitejs.dev' },
{ icon: 'github', link: 'https://github.com/vitejs/vite' },
],
algolia: {
appId: '7H67QR5P0A',
apiKey: 'deaab78bcdfe96b599497d25acc6460e',
indexName: 'vitejs',
searchParameters: {
facetFilters: ['tags:en'],
},
},
carbonAds: {
code: 'CEBIEK3N',
placement: 'vitejsdev',
},
footer: {
message: `Released under the MIT License. (${commitRef})`,
copyright: 'Copyright © 2019-present Evan You & Vite Contributors',
},
nav: [
{ text: 'Guide', link: '/guide/', activeMatch: '/guide/' },
{ text: 'Config', link: '/config/', activeMatch: '/config/' },
{ text: 'Plugins', link: '/plugins/', activeMatch: '/plugins/' },
{
text: 'Tài nguyên',
items: [
{ text: 'Đội ngũ', link: '/team' },
{ text: 'Phát hành', link: '/releases' },
{
items: [
{
text: 'Twitter',
link: 'https://twitter.com/vite_js',
},
{
text: 'Nhắn tin Discord',
link: 'https://chat.vitejs.dev',
},
{
text: 'Awesome Vite',
link: 'https://github.com/vitejs/awesome-vite',
},
{
text: 'Cộng đồng DEV',
link: 'https://dev.to/t/vite',
},
{
text: 'Tương thích với Rollup Plugin',
link: 'https://vite-rollup-plugins.patak.dev/',
},
{
text: 'Nhật ký thay đổi',
link: 'https://github.com/vitejs/vite/blob/main/packages/vite/CHANGELOG.md',
},
],
},
],
},
{
text: 'Phiên bản',
items: versionLinks,
},
],
sidebar: {
'/guide/': [
{
text: 'Hướng dẫn',
items: [
{
text: 'Tại sao chọn Vite',
link: '/guide/why',
},
{
text: 'Bắt đầu',
link: '/guide/',
},
{
text: 'Tính năng',
link: '/guide/features',
},
{
text: 'CLI',
link: '/guide/cli',
},
{
text: 'Sử dụng Plugins',
link: '/guide/using-plugins',
},
{
text: 'Đóng gói trước Phần phụ thuộc',
link: '/guide/dep-pre-bundling',
},
{
text: 'Xử lý nội dung tĩnh',
link: '/guide/assets',
},
{
text: 'Xây dựng cho Sản xuất',
link: '/guide/build',
},
{
text: 'Triển khai một Trang Web Tĩnh',
link: '/guide/static-deploy',
},
{
text: 'Các biến và Chế độ Env',
link: '/guide/env-and-mode',
},
{
text: 'Hiển thị phía máy chủ (SSR)',
link: '/guide/ssr',
},
{
text: 'Tích hợp Backend',
link: '/guide/backend-integration',
},
{
text: 'So sánh',
link: '/guide/comparisons',
},
{
text: 'Xử lý Sự cố',
link: '/guide/troubleshooting',
},
{
text: 'Chuyển đổi từ v3',
link: '/guide/migration',
},
],
},
{
text: 'APIs',
items: [
{
text: 'Plugin API',
link: '/guide/api-plugin',
},
{
text: 'HMR API',
link: '/guide/api-hmr',
},
{
text: 'JavaScript API',
link: '/guide/api-javascript',
},
{
text: 'Cấu hình Tham khảo',
link: '/config/',
},
],
},
],
'/config/': [
{
text: 'Cấu hình',
items: [
{
text: 'Cấu hình Vite',
link: '/config/',
},
{
text: 'Tùy chọn Chia sẻ',
link: '/config/shared-options',
},
{
text: 'Tùy chọn Máy chủ',
link: '/config/server-options',
},
{
text: 'Tùy chọn Xây dựng',
link: '/config/build-options',
},
{
text: 'Tùy chọn Xem trước',
link: '/config/preview-options',
},
{
text: 'Tùy chọn Tối ưu hóa Dep',
link: '/config/dep-optimization-options',
},
{
text: 'Tùy chọn SSR',
link: '/config/ssr-options',
},
{
text: 'Tùy chọn Worker',
link: '/config/worker-options',
},
],
},
],
},
},
})