-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvite.config.ts
More file actions
53 lines (51 loc) · 1.22 KB
/
Copy pathvite.config.ts
File metadata and controls
53 lines (51 loc) · 1.22 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
41
42
43
44
45
46
47
48
49
50
51
52
53
import { defineConfig } from 'vite';
import react from '@vitejs/plugin-react';
import dts from 'vite-plugin-dts';
import { resolve } from 'path';
// https://vitejs.dev/config/
export default defineConfig(({ mode }) => {
if (mode === 'library') {
return {
plugins: [
react(),
dts({
insertTypesEntry: true,
include: ['src/components/VideoCorner/**/*'],
outDir: 'dist',
}),
],
build: {
lib: {
entry: resolve(__dirname, 'src/components/VideoCorner/index.ts'),
name: 'ReactVideoCorner',
formats: ['es', 'umd'],
fileName: (format) => `index.${format === 'es' ? 'esm' : format}.js`,
},
rollupOptions: {
external: ['react', 'react-dom'],
output: {
exports: 'named',
globals: {
react: 'React',
'react-dom': 'ReactDOM',
},
},
},
sourcemap: true,
emptyOutDir: true,
},
optimizeDeps: {},
};
}
// Development mode
return {
plugins: [react()],
server: {
port: 5175,
strictPort: true,
host: true,
open: true
},
optimizeDeps: {},
};
});