-
Notifications
You must be signed in to change notification settings - Fork 1
/
vite.config.ts
47 lines (43 loc) · 967 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
45
46
47
import DTS from 'vite-plugin-dts';
import VueJSX from '@vitejs/plugin-vue-jsx';
import { defineConfig } from 'vite';
import path from 'path';
const root = process.cwd();
const mode = process.env.MODE as 'production' | 'demo';
const productionConfig = defineConfig({
root,
plugins: [
VueJSX(),
DTS({
outputDir: 'dist/types',
}),
],
build: {
target: 'es2020',
lib: {
entry: path.resolve(root, 'src', 'lib.ts'),
name: 'wowerlay',
formats: ['es', 'umd'],
},
rollupOptions: {
external: ['vue'],
output: {
globals: {
vue: 'Vue',
},
},
},
},
});
const demoConfig = defineConfig({
root: path.join(root, 'demo'),
plugins: [VueJSX()],
build: {
emptyOutDir: true,
outDir: path.join(root, 'dist-demo'),
},
optimizeDeps: {
include: ['highlight.js', 'bottom-sheet-vue3'],
},
});
export default mode === 'demo' ? demoConfig : productionConfig;