-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvite.config.ts
41 lines (40 loc) · 1.02 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
import vue from '@vitejs/plugin-vue'
import { fileURLToPath, URL } from 'node:url'
import { resolve } from 'path'
import { defineConfig } from 'vite'
import dts from 'vite-plugin-dts'
export default defineConfig({
plugins: [
vue(),
dts({ tsconfigPath: './tsconfig.app.json', include: ['src/**/*.ts', 'src/**/*.vue'], rollupTypes: true }),
],
resolve: {
alias: {
'@': fileURLToPath(new URL('./src', import.meta.url)),
},
},
build: {
emptyOutDir: true,
lib: {
entry: {
toolbelt: resolve(__dirname, 'src/toolbelt.ts'),
'vue/index': resolve(__dirname, 'src/vue/index.ts'),
},
formats: ['es', 'cjs'],
fileName: (format, entryName) => {
const extension = format === 'es' ? 'js' : 'cjs'
return `${entryName}.${extension}`
},
},
rollupOptions: {
external: ['vue', 'vue-router'],
output: {
preserveModules: false,
globals: {
vue: 'Vue',
'vue-router': 'vueRouter',
},
},
},
},
})