forked from vimaec/vim-webgl-component
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathvite.config.js
More file actions
35 lines (34 loc) · 968 Bytes
/
vite.config.js
File metadata and controls
35 lines (34 loc) · 968 Bytes
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
import { defineConfig } from 'vite'
import { resolve } from 'path'
import react from '@vitejs/plugin-react'
export default defineConfig({
plugins: [react()],
build: {
sourcemap: true,
lib: {
formats: ['iife', 'es'],
entry: resolve(__dirname, 'src/vim-web/index.ts'),
name: 'VIMReact'
},
rollupOptions: {
external: ['react', 'react-dom', /^react\//, /^react-dom\//],
output: {
// Save react and react-dom as globals so they can be provided as external dependencies
globals: {
'react': 'React',
'react/jsx-runtime': 'React',
'react-dom': 'ReactDOM',
'react-dom/client': 'ReactDOM'
},
// Keep style.css name
assetFileNames: (assetInfo) => {
if (assetInfo.names[0] === 'vim-web.css') {
return 'style.css'; // Keep name
}
return assetInfo.names[0];
},
}
},
minify: false
}
})