-
Notifications
You must be signed in to change notification settings - Fork 36
/
Copy pathvite.config.ts
41 lines (35 loc) · 950 Bytes
/
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
/// <reference types="vitest" />
import react from '@vitejs/plugin-react'
import { defineConfig } from 'vite'
import pkg from './package.json'
const external = [
// ...Object.keys(pkg.dependencies || {}),
...Object.keys(pkg.peerDependencies || {}),
].map(name => new RegExp(`^${name}(/.*)?`))
export default defineConfig(({ mode }) => {
return {
build: {
target: 'es2020',
lib: {
entry: {
'12': 'src/12/index.ts',
'16': 'src/16/index.ts',
'20': 'src/20/index.ts',
social: 'src/social/index.ts',
reactions: 'src/reactions/index.ts',
},
formats: ['es', 'cjs'],
fileName: (format, entryName) => `${entryName}/index.${format}.js`,
},
sourcemap: true,
emptyOutDir: mode === 'production',
rollupOptions: {
external,
},
},
plugins: [react()],
test: {
environment: 'happy-dom',
},
}
})