-
Notifications
You must be signed in to change notification settings - Fork 1
/
vite.config.ts
66 lines (64 loc) · 1.67 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
/// <reference types="vitest" />
import { resolve } from 'path';
import typescript from '@rollup/plugin-typescript';
import react from '@vitejs/plugin-react';
import { glob } from 'glob';
import autoExternal from 'rollup-plugin-auto-external';
import { defineConfig } from 'vite';
// https://vitejs.dev/config/
export default defineConfig({
plugins: [react()],
resolve: {
alias: {
'@': resolve(__dirname, './src'),
},
},
build: {
sourcemap: true,
lib: {
entry: [
resolve(__dirname, 'src/index.ts'),
resolve(__dirname, 'src/plugin.ts'),
...glob.sync(resolve(__dirname, 'src/elements/**/*.tsx'), { ignore: ['**/*\.test\.tsx', '**/*\.stories\.tsx'] }),
],
name: 'kubetail-ui',
formats: ['es', 'cjs'],
},
rollupOptions: {
plugins: [
typescript({
sourceMap: false,
declaration: true,
outDir: "dist",
include: 'src/**/*',
exclude: [
'src/**/*.stories.ts',
'src/**/*.stories.tsx'
],
allowImportingTsExtensions: false // https://github.com/rollup/plugins/discussions/1536
}),
autoExternal(),
],
external: [
'@heroicons/react/20/solid',
'@heroicons/react/24/solid',
'@restart/ui/Button',
'react',
'react-dom',
'react/jsx-runtime',
'tailwindcss/colors',
'tailwindcss/plugin',
],
output: {
// Preserve the directory structure
preserveModules: true,
preserveModulesRoot: 'src'
},
},
},
test: {
environment: 'jsdom',
globals: true,
setupFiles: ['vitest.setup.ts'],
},
});