-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvite.config.ts
93 lines (84 loc) · 2.09 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
81
82
83
84
85
86
87
88
89
90
91
92
93
import type { UserConfig } from 'vite'
import process from 'node:process'
import { fileURLToPath, URL } from 'node:url'
import MarkdownItShiki from '@shikijs/markdown-it'
import Vue from '@vitejs/plugin-vue'
import Markdown from 'unplugin-vue-markdown/vite'
import { defineConfig } from 'vite'
import dts from 'vite-plugin-dts'
import { qrcode } from 'vite-plugin-qrcode'
import vueDevTools from 'vite-plugin-vue-devtools'
const config: UserConfig = {
plugins: [
qrcode(),
Vue({
include: [/\.vue$/, /\.md$/],
}),
vueDevTools(),
// https://github.com/antfu/vite-plugin-md
// Don't need this? Try vitesse-lite: https://github.com/antfu/vitesse-lite
Markdown({
headEnabled: false,
async markdownItSetup(md) {
// https://prismjs.com/
// md.use(MarkdownPrism)
md.use(await MarkdownItShiki({
langs: [
'vue',
'js',
'ts',
'styl',
'css',
'scss',
'sass',
'swift',
'objc',
'html',
'json',
'json5',
'console',
'md',
'xml',
],
themes: {
light: 'github-light',
dark: 'github-dark',
},
}))
},
}),
],
resolve: {
alias: {
'@': fileURLToPath(new URL('./lib', import.meta.url)),
},
conditions: ['module', 'browser'],
},
// server: {
// port: 8080,
// },
}
if (!process.env.BUILD_DEMO) {
config.plugins?.push(
dts({
rollupTypes: true,
}),
)
// https://vitejs.dev/guide/build.html#library-mode
config.build = {
// sourcemap: false,
// cssMinify: 'lightningcss',
// cssTarget: 'es2015',
lib: {
formats: ['es'],
entry: [fileURLToPath(new URL('./lib/lib.ts', import.meta.url))],
fileName: 'lib',
},
rollupOptions: {
// preserveEntrySignatures: "strict",
external: ['vue', '@vueuse/core', 'zeed'], // Object.keys(pkg.dependencies),
},
}
}
// https://vitejs.dev/config/
export default defineConfig(config)