-
-
Notifications
You must be signed in to change notification settings - Fork 45
/
Copy pathvite.config.ts
74 lines (72 loc) · 1.79 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
import { defineConfig } from 'vite'
import Vue from '@vitejs/plugin-vue'
import Jsx from '@vitejs/plugin-vue-jsx'
import Md from 'vite-plugin-md'
import { cdn } from 'vite-plugin-cdn2'
import Prism from 'prismjs'
import path from 'path'
import { playground } from './plugins/mdi/markdown'
import { table } from './plugins/mdi/table'
import { loadStaticMarkdonModule } from './plugins/vite/loader'
const external = ['@fect-ui/vue-hooks', '@fect-ui/vue-icons'].reduce(
(acc, cur) => (Object.assign(acc, { [cur]: [cur] }), acc),
{}
)
export default defineConfig({
root: 'docs',
publicDir: path.join(process.cwd(), 'public'),
plugins: [
Jsx(),
Vue({
include: [/\.vue$/, /\.md$/]
}),
/**
* From vite-plugin-md we can define the custom frontmatter.
* docs: https://github.com/yankeeinlondon/meta-builder
*/
Md({
wrapperClasses: 'doc-container',
markdownItOptions: {
highlight: (str) => Prism.highlight(str, Prism.languages.javascript, 'javascript')
},
builders: [playground(), table()]
}),
loadStaticMarkdonModule(),
{
...cdn({
isProduction: true,
modules: [
{
name: 'vue',
global: 'Vue'
},
{
name: 'prismjs',
global: 'Prism',
spare: 'https://cdn.jsdelivr.net/npm/prismjs@1.29.0/prism.js'
},
{
name: 'vue-router',
global: 'VueRouter'
}
]
}),
apply: 'build'
}
],
// https://github.com/vitejs/vite/issues/5270
optimizeDeps: {
esbuildOptions: {
target: 'es2020'
}
},
build: {
emptyOutDir: true,
outDir: path.join(__dirname, 'dist'),
rollupOptions: {
output: {
manualChunks: external
}
}
}
})