-
Notifications
You must be signed in to change notification settings - Fork 24
/
Copy pathvite.config.ts
44 lines (38 loc) · 912 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
44
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import { resolve } from 'path'
const resolvePath = (str: string) => resolve(__dirname, str)
const isProd = process.env.NODE_ENV === 'production'
const devConfig = defineConfig({
root: './demo',
plugins: [vue()],
build: {
outDir: '../dist-demo',
emptyOutDir: true,
rollupOptions: {
input: {
main: resolve(__dirname, 'demo/index.html'),
},
},
},
})
const prodConfig = defineConfig({
build: {
lib: {
entry: resolvePath('lib/index.ts'),
name: 'vue-tribute',
fileName: format => `vue-tribute.${format}.js`,
},
rollupOptions: {
external: ['vue', 'tributejs'],
output: {
exports: 'named',
globals: {
vue: 'Vue',
tributejs: 'Tribute',
},
},
},
},
})
export default isProd ? prodConfig : devConfig