Repository navigation
Expand file tree
/
Copy pathvite.config.ts
More file actions
96 lines (92 loc) · 2.46 KB
/
Copy pathvite.config.ts
File metadata and controls
96 lines (92 loc) · 2.46 KB
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
import { fileURLToPath } from 'node:url'
import { presetAttributify, presetWind3 } from 'unocss'
import Unocss from 'unocss/vite'
import Components from 'unplugin-vue-components/vite'
import { defineConfig } from 'vite'
export default defineConfig({
logLevel: 'info',
optimizeDeps: {
exclude: [
'@vueuse/core',
'vitepress',
],
},
experimental: {
enableNativePlugin: true,
},
server: {
hmr: {
overlay: false,
},
},
resolve: {
alias: [
{
find: /^.*\/VPNavBarTitle\.vue$/,
replacement: fileURLToPath(
new URL('./.vitepress/theme/components/vp/NavBarTitle.vue', import.meta.url),
),
},
{
find: /^.*\/VPTeamMembersItem\.vue$/,
replacement: fileURLToPath(
new URL('./.vitepress/theme/components/vp/TeamMembersItem.vue', import.meta.url),
),
},
],
},
plugins: [
// https://github.com/antfu/vite-plugin-components
Components({
dirs: [
'.vitepress/theme/components',
],
// allow auto load markdown components under `./src/components/`
extensions: ['vue', 'md'],
// allow auto import and register components used in markdown
include: [/\.vue$/, /\.vue\?vue/, /\.md$/],
// generate `components.d.ts` for ts support with Volar
dts: '.vitepress/components.d.ts',
}),
// https://github.com/unocss/unocss
Unocss({
presets: [presetWind3(), presetAttributify()],
}),
/* {
name: 'fix-workbox-window-import',
apply: 'build',
enforce: 'post',
config(config) {
let noExternal = config.ssr?.noExternal
console.log('Original ssr.noExternal:', noExternal)
if (noExternal && Array.isArray(noExternal)) {
noExternal = noExternal.filter((dep) => {
return typeof dep === 'string' ? dep !== 'workbox-window' : false
})
config.ssr!.noExternal = noExternal
console.log('Changed ssr.noExternal:', noExternal)
}
},
configEnvironment(_name, config) {
if (config.consumer === 'client') {
return {
build: {
rolldownOptions: {
noExternal: ['workbox-window'],
},
},
}
}
else {
return {
build: {
rolldownOptions: {
external: ['workbox-window'],
},
},
}
}
},
}, */
],
})