-
Notifications
You must be signed in to change notification settings - Fork 0
/
vite.config.ts
42 lines (39 loc) · 1.11 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
42
import { defineConfig } from 'vite';
import vue from '@vitejs/plugin-vue';
import dts from 'vite-plugin-dts';
// check if we are building the library
const isBuildingLibrary =
process.env.BUILD_LIB !== undefined && process.env.BUILD_LIB === 'true';
const plugins = [vue()];
// if we are building the library, add the dts plugin to generate the typings
if (isBuildingLibrary) {
plugins.push(dts({ exclude: ['src/examples/**/*', 'src/lib/*.spec.ts'] }));
}
// https://vitejs.dev/config/
export default defineConfig({
base: isBuildingLibrary ? '/' : '/vue-task-management/',
plugins,
build: isBuildingLibrary
? {
lib: {
entry: 'src/lib/index.ts',
name: 'VueTaskManagement',
fileName: (format) => `vue-task-management.${format}.js`,
},
rollupOptions: {
external: ['vue'],
output: {
globals: {
vue: 'Vue',
},
},
},
}
: {
outDir: 'dist/examples',
assetsDir: './',
rollupOptions: {
input: ['src/examples/main.ts', './index.html'],
},
},
});