-
Notifications
You must be signed in to change notification settings - Fork 3
/
vite.config.ts
61 lines (57 loc) · 1.24 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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
import { resolve } from 'path'
import vue from '@vitejs/plugin-vue'
import { defineConfig } from 'vite'
import svgLoader from 'vite-svg-loader'
// https://vitejs.dev/config/
// eslint-disable-next-line import/no-default-export
export default defineConfig(({ mode }) => {
const baseConfig = {
resolve: {
alias: [
{
find: '@/demo',
replacement: resolve(__dirname, './demo'),
},
{
find: '@',
replacement: resolve(__dirname, 'src'),
},
],
},
plugins: [vue(), svgLoader()],
}
if (mode == 'demo') {
return {
root: './demo',
...baseConfig,
build: {
cssCodeSplit: false,
},
}
}
return {
...baseConfig,
build: {
emptyOutDir: false,
sourcemap: true,
lib: {
entry: resolve(__dirname, 'src/index.ts'),
name: 'vue-charts',
},
rollupOptions: {
external: [
'vue',
'@prefecthq/prefect-design',
'@prefecthq/vue-compositions',
],
output: {
exports: 'named',
// Provide vue as a global variable to use in the UMD build
globals: {
vue: 'Vue',
},
},
},
},
}
})