-
Notifications
You must be signed in to change notification settings - Fork 18
/
vite.config.ts
42 lines (38 loc) · 942 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
import { defineConfig } from 'vite'
import dts from 'vite-plugin-dts'
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'),
sandbox: resolve(__dirname, 'demo/sandbox/index.html'),
},
},
},
})
const prodConfig = defineConfig({
build: {
lib: {
entry: resolvePath('lib/index.ts'),
name: 'vue-input-autowidth',
fileName: format => `vue-input-autowidth.${format}.js`,
},
rollupOptions: {
external: ['vue'],
},
},
plugins: [
dts({
insertTypesEntry: true,
}),
],
})
export default isProd ? prodConfig : devConfig