Repository navigation
Expand file tree
/
Copy pathvite.config.js
More file actions
61 lines (56 loc) · 1.7 KB
/
Copy pathvite.config.js
File metadata and controls
61 lines (56 loc) · 1.7 KB
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 { fileURLToPath, URL } from 'node:url';
import { defineConfig } from 'vite';
import vue from '@vitejs/plugin-vue';
import tailwindcss from '@tailwindcss/vite';
const alias = {
'@': fileURLToPath(new URL('./src', import.meta.url)),
};
// Demo app (npm run dev / npm run build): Tailwind + the design-system theme come from src/assets/vof-demo.css
const demoConfig = defineConfig({
plugins: [vue(), tailwindcss()],
resolve: { alias },
build: {
outDir: 'dist-app',
},
});
// Library (npm run pkg): the consuming app provides the design system, so its styles and state are shared
const libConfig = defineConfig({
plugins: [vue()],
resolve: { alias },
build: {
lib: {
entry: fileURLToPath(new URL('./src/entry.js', import.meta.url)),
name: 'VueOpenapiForm',
// the proper extensions are added: vue-openapi-form.js and vue-openapi-form.umd.cjs
fileName: 'vue-openapi-form',
formats: ['es', 'umd'],
},
rollupOptions: {
external: [
'vue',
'vee-validate',
'@vee-validate/rules',
'js-yaml',
'@lucide/vue',
/^@ac-design\/design-system/,
],
output: {
exports: 'named',
globals: {
vue: 'Vue',
'vee-validate': 'VeeValidate',
'@vee-validate/rules': 'VeeValidateRules',
'js-yaml': 'jsyaml',
'@lucide/vue': 'LucideVue',
'@ac-design/design-system': 'AcDesignSystem',
'@ac-design/design-system/editor': 'AcDesignSystemEditor',
},
},
},
copyPublicDir: false,
},
});
export default defineConfig(({ command }) => {
if (command === 'build' && process.env.MODE === 'lib') return libConfig;
return demoConfig;
});