-
Notifications
You must be signed in to change notification settings - Fork 18
/
Copy pathvite.config.mts
38 lines (35 loc) · 958 Bytes
/
vite.config.mts
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
import { defineConfig } from 'vite';
import { version } from './package.json';
import dts from 'vite-plugin-dts';
console.log('process.env.NODE_ENV:', process.env.NODE_ENV);
export default defineConfig({
root: process.env.NODE_ENV === 'development' ? './playground' : undefined,
plugins: [dts()],
define: {
'process.env.VITE_IS_E2E': JSON.stringify(process.env.VITE_IS_E2E ?? ''),
'process.env.VERSION': JSON.stringify(version),
},
build: {
sourcemap: true,
outDir: 'lib',
lib: {
entry: {
index: './src/index.ts',
worker: './src/worker.ts',
},
cssFileName: 'style',
formats: ['es', 'cjs'],
fileName: (format, entryName) => `${entryName}.${format}.js`,
},
rollupOptions: {
external: ['react', 'react-dom', 'yjs'],
output: {
globals: {
react: 'React',
'react-dom': 'ReactDOM',
yjs: 'Y',
},
},
},
},
});