generated from github/codespaces-react
-
Notifications
You must be signed in to change notification settings - Fork 0
/
vite.config.ts
33 lines (32 loc) · 939 Bytes
/
vite.config.ts
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
import { resolve } from 'path'
import { defineConfig } from "vite";
import react from "@vitejs/plugin-react";
import { ModuleFormat } from 'rollup';
import replace from '@rollup/plugin-replace';
import externalGlobals from "rollup-plugin-external-globals";
// https://vitejs.dev/config/
export default defineConfig({
plugins: [react()],
build: {
target: 'esnext',
lib: {
// Could also be a dictionary or array of multiple entry points
entry: resolve(__dirname, 'src/Test.bench.tsx'),
name: 'MyLib',
// the proper extensions will be added
fileName: (format: ModuleFormat, entryName: string) => `${entryName}.mjs`,
formats: ['es']
},
rollupOptions: {
plugins: [
replace({
'process.env.NODE_ENV': JSON.stringify('production'),
}),
externalGlobals({
'react': 'React',
'react-dom': 'ReactDOM',
})
]
},
}
})