-
Notifications
You must be signed in to change notification settings - Fork 0
/
vite.config.ts
54 lines (51 loc) · 1.49 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
/// <reference types="vite/client" />
/// <reference types="vitest" />
import { resolve } from 'path'
import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react'
import libCss from 'vite-plugin-libcss'
import dts from 'vite-plugin-dts'
import excludeDependenciesFromBundle from 'rollup-plugin-exclude-dependencies-from-bundle'
const res = path => resolve(__dirname, path)
// https://vitejs.dev/config/
export default defineConfig({
plugins: [
react(),
libCss(),
dts({ tsconfigPath: res('tsconfig.build.json') })
],
resolve: {
alias: {
'@': res('src')
}
},
test: {
globals: true,
environment: 'jsdom',
setupFiles: './src/test/setup'
// you might want to disable it, if you don't have tests that rely on CSS
// since parsing CSS is slow
// css: true,
},
build: {
lib: {
// The entry file will contain exports that can be imported by users of your package
entry: res('src/main.tsx'),
formats: ['es'],
name: 'a-ui'
// fileName: format => `a-ui.${format}.js`
},
rollupOptions: {
// Make sure to externalize those dependencies that you don't want packaged into the library
// external: ['react', 'react-dom'],
plugins: [excludeDependenciesFromBundle()],
output: {
// A global variable is provided for these externalized dependencies in the UMD build pattern
globals: {
react: 'React',
'react-dom': 'react-dom'
}
}
}
}
})