-
Notifications
You must be signed in to change notification settings - Fork 0
/
vite.config.ts
43 lines (41 loc) · 1017 Bytes
/
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
import * as path from 'node:path'
import vue from '@vitejs/plugin-vue'
import reactivityTransform from '@vue-macros/reactivity-transform/vite'
import fastglob from 'fast-glob'
import { defineConfig } from 'vite'
import dts from 'vite-plugin-dts'
function stripExtension(file: string) {
return file.slice(0, -path.extname(file).length)
}
export default defineConfig(async () => ({
build: {
minify: false,
lib: {
entry: {
index: 'src/index.ts',
...Object.fromEntries((await fastglob('src/*/*.vue')).map(file => {
return [stripExtension(path.relative('src', file)), file]
})),
},
formats: ['es' as const],
fileName: () => '[name].js',
},
rollupOptions: {
external: [
'vue',
],
output: {
chunkFileNames: 'chunks/dep-[hash].js',
},
},
},
plugins: [
vue(),
reactivityTransform(),
dts({
entryRoot: 'src',
cleanVueFileName: true,
staticImport: true,
}),
],
}))