-
Notifications
You must be signed in to change notification settings - Fork 0
/
vite.config.ts
37 lines (36 loc) · 909 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
import path from 'node:path'
import process from 'node:process'
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
// https://vitejs.dev/config/
export default defineConfig((_) => {
const dev = process.argv.includes('--watch')
return {
plugins: [vue()],
resolve: {
alias: {
'@': path.resolve(__dirname, 'src'),
},
},
build: {
outDir: 'dist',
lib: {
entry: './src/main.ts',
name: 'tree',
fileName: () => 'main.js',
formats: ['es', 'cjs', 'umd'],
},
emptyOutDir: true,
sourcemap: dev ? 'inline' : false,
rollupOptions: {
external: (id) => {
return id.includes('spec.') || id.includes('test.') || id.includes('node_modules')
},
output: {
dynamicImportInCjs: false,
inlineDynamicImports: true,
},
},
},
}
})