-
Notifications
You must be signed in to change notification settings - Fork 2
/
vite.config.js
36 lines (34 loc) · 953 Bytes
/
vite.config.js
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
import {defineConfig} from 'vite'
import react from '@vitejs/plugin-react'
import pkg from './package.json';
import resolve from '@rollup/plugin-node-resolve';
const peerDependencies = Object.keys(pkg.peerDependencies || {});
// https://vite.dev/config/
export default defineConfig({
plugins: [
react(),
resolve()
],
build: {
lib: {
entry: 'src/index.js',
formats: ['es', 'cjs']
},
rollupOptions: {
external: [...peerDependencies, 'react/jsx-runtime'],
output: {
exports: 'named',
// This is so that we can have tree shaking working.
preserveModules: true,
format: 'es'
// generatedCode: 'es2015',
},
}
},
test: {
globals: true,
environment: 'jsdom',
// Reset mocks before each test
restoreMocks: true
}
})