-
-
Notifications
You must be signed in to change notification settings - Fork 158
Expand file tree
/
Copy pathvite.config.js
More file actions
40 lines (39 loc) · 1.13 KB
/
Copy pathvite.config.js
File metadata and controls
40 lines (39 loc) · 1.13 KB
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
import { defineConfig } from 'vite';
import react from '@vitejs/plugin-react';
import { resolve } from 'path';
export default defineConfig(({ command }) => ({
plugins: [react()],
build:
command === 'build'
? {
lib: {
entry: resolve(__dirname, 'src/index.js'),
name: 'ReactFrameComponent',
formats: ['es', 'umd'],
fileName: (format) =>
`react-frame-component.${format === 'es' ? 'esm' : format}.js`
},
rollupOptions: {
external: [
'react',
'react/jsx-runtime',
'react/jsx-dev-runtime',
'react-dom',
'prop-types'
],
output: {
globals: {
react: 'React',
'react/jsx-runtime': 'react/jsx-runtime',
'react/jsx-dev-runtime': 'react/jsx-dev-runtime',
'react-dom': 'ReactDOM',
'prop-types': 'PropTypes'
},
exports: 'named'
}
},
minify: false,
sourcemap: true
}
: {}
}));