-
Notifications
You must be signed in to change notification settings - Fork 16
/
vite.config.ts
80 lines (78 loc) · 1.74 KB
/
vite.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
import { resolve } from 'path'
import { defineConfig } from 'vite'
import Components from 'unplugin-vue-components/vite'
import Icons from 'unplugin-icons/vite'
import IconsResolver from 'unplugin-icons/resolver'
import WindiCSS from 'vite-plugin-windicss'
import ViteRestart from 'vite-plugin-restart'
import axios from 'axios'
const sponsorUrl = 'https://opencollective.com/windicss/members.json'
export default defineConfig({
resolve: {
alias: {
'@/': `${resolve(__dirname, '.vitepress/theme')}/`,
},
},
build: {
rollupOptions: {
output: {
manualChunks: {
windicss: ['windicss'],
},
},
},
},
server: {
proxy: {
'/.netlify': {
target: 'http://localhost:8888',
},
},
},
plugins: [
Components({
dirs: [
'.vitepress/theme/components',
],
extensions: ['vue', 'ts'],
include: [/\.vue$/, /\.vue\?vue/, /\.md$/],
resolvers: [
IconsResolver({
componentPrefix: '',
}),
],
dts: true,
}),
Icons(),
WindiCSS(),
ViteRestart({
restart: '.vitepress/config/*.*',
}),
{
name: 'sponsor',
resolveId(id) {
return id === 'virtual:sponsor' ? id : null
},
async load(id) {
if (id !== 'virtual:sponsor')
return
const { data } = await axios.get(sponsorUrl)
return `export default ${JSON.stringify(data)}`
},
},
],
optimizeDeps: {
include: [
'axios',
'@vueuse/core',
'windicss/utils/style',
'windicss',
'json5',
'prismjs',
'prismjs/components/prism-css',
'codemirror',
'codemirror/mode/javascript/javascript',
'codemirror/mode/css/css',
],
},
})