-
Notifications
You must be signed in to change notification settings - Fork 1
/
vite.config.js
39 lines (38 loc) · 1.01 KB
/
vite.config.js
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
import { fileURLToPath, URL } from 'node:url'
import { resolve } from 'path'
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import { createSvgIconsPlugin } from 'vite-plugin-svg-icons'
// import libCss from 'vite-plugin-libcss'
const isBuildExample = !!process.env.EXAMPLE
export default defineConfig({
base: isBuildExample ? '/milkdown-vue' : '/',
plugins: [
vue(),
// libCss()
createSvgIconsPlugin({
// 指定需要缓存的图标文件夹
iconDirs: [resolve(process.cwd(), 'src/components/svg')],
// 指定symbolId格式
symbolId: 'icon-[dir]-[name]'
})
],
build: isBuildExample
? {}
: {
lib: {
entry: fileURLToPath(new URL('./src/components/index.js', import.meta.url)),
name: 'milkdown',
formats: ['esm'],
fileName: (format) => `milkdown.${format}.js`
},
rollupOptions: {
external: ['vue'],
output: {
globals: {
vue: 'Vue'
}
}
}
}
})