-
Notifications
You must be signed in to change notification settings - Fork 1
/
vite.config.ts
42 lines (40 loc) · 1.36 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
// https://github.com/quasarframework/quasar/issues/8432
// https://vitejs.dev/config/
import path from 'path';
import { defineConfig } from 'vite';
import vue from '@vitejs/plugin-vue';
import dts from 'vite-plugin-dts';
import { visualizer } from 'rollup-plugin-visualizer';
import { configDefaults } from 'vitest/config';
const isStorybook = !!process.env.STORYBOOK;
const isCI = !!process.env.CI;
export default defineConfig({
plugins: [vue(), dts(), !isCI && visualizer({ open: true })].filter(Boolean),
build: {
lib: {
entry: path.resolve(__dirname, 'src/index.ts'),
name: 'timeline-vue',
formats: ['es', 'umd'],
fileName: (format: string) => `timeline-vue.${format}.js`,
},
rollupOptions: {
// Marcar 'vue' e 'material-symbols' como externas, exceto quando estiver buildando o Storybook
external: isStorybook ? [] : ['vue', 'material-symbols/outlined.css'],
output: {
globals: isStorybook
? {}
: { vue: 'Vue', 'material-symbols/outlined.css': 'MaterialSymbols' },
},
},
cssCodeSplit: true, // Dividir o CSS
emptyOutDir: false,
},
optimizeDeps: {
exclude: isStorybook ? [] : ['vue', 'material-symbols/outlined.css'], // Não exclua no Storybook
},
test: {
globals: true,
environment: 'happy-dom',
exclude: [...configDefaults.exclude, 'dist/**'],
},
});