-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvite.config.ts
83 lines (78 loc) · 1.69 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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
import path from 'node:path'
import type { UserConfig } from 'vitest/config'
import { defineConfig } from 'vitest/config'
import Vue from '@vitejs/plugin-vue'
const baseConfig: UserConfig = {
resolve: {
alias: {
'~/': `${path.resolve(__dirname, 'src')}/`,
'@assets/': `${path.resolve(__dirname, 'src/assets')}/`,
},
},
build: {
lib: {
entry: './src/entry.ts',
name: 'BuilderComponent',
fileName: 'builder-component',
formats: ['es'],
},
rollupOptions: {
external: [
'@apollo/client',
'@headlessui/vue',
'@stripe/stripe-js',
'@types/lodash-es',
'@vue/apollo-composable',
'@vueuse/core',
'dayjs',
'graphql',
'graphql-tag',
'lodash-es',
'p-retry',
'tiny-invariant',
'ts-pattern',
'vee-validate',
'vue',
'vue-i18n',
'vue-router',
'yup',
],
},
minify: false,
},
plugins: [],
// https://github.com/vitest-dev/vitest
test: {
environment: 'jsdom',
},
}
export default defineConfig(({ mode }): UserConfig => {
if (mode === 'browser') {
return {
...baseConfig,
mode: 'production',
define: {
'process.env.NODE_ENV': JSON.stringify('production'),
},
build: {
lib: {
entry: './src/entry.ts',
name: 'BuilderComponent',
fileName: 'builder-component',
formats: ['es'],
},
minify: false,
},
plugins: [
baseConfig.plugins,
Vue({
isProduction: true,
}),
],
}
}
return {
...baseConfig,
plugins: [baseConfig.plugins, Vue()],
}
})