-
Notifications
You must be signed in to change notification settings - Fork 11
/
vite.config.mts
57 lines (53 loc) · 1.22 KB
/
vite.config.mts
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
import { resolve } from 'path'
import vue from '@vitejs/plugin-vue'
import { defineConfig } from 'vite'
import VueDevTools from 'vite-plugin-vue-devtools'
import svgLoader from 'vite-svg-loader'
// https://vitejs.dev/config/
export default defineConfig(({ mode }) => {
const baseConfig = {
resolve: {
alias: [
{
find: '@/demo',
replacement: resolve(__dirname, './demo'),
},
{
find: '@',
replacement: resolve(__dirname, './src'),
},
],
},
plugins: [vue(), svgLoader(), VueDevTools()],
}
if (mode == 'demo') {
return {
root: './demo',
...baseConfig,
build: {
cssCodeSplit: false,
},
}
}
return {
...baseConfig,
build: {
copyPublicDir: true,
lib: {
entry: resolve(__dirname, 'src/index.ts'),
name: 'PrefectDesign',
},
rollupOptions: {
// ensures vue isn't added to the bundle
external: ['vue', 'vue-router', 'vue-compositions'],
output: {
exports: 'named',
// Provide vue as a global variable to use in the UMD build
globals: {
vue: 'Vue',
},
},
},
},
}
})