-
Notifications
You must be signed in to change notification settings - Fork 21
Expand file tree
/
Copy pathvite.browser.config.mts
More file actions
58 lines (56 loc) · 1.48 KB
/
vite.browser.config.mts
File metadata and controls
58 lines (56 loc) · 1.48 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
54
55
56
57
58
import react from '@vitejs/plugin-react'
import type { ConfigEnv, UserConfig } from 'vite'
import { defineConfig } from 'vite'
import tsconfigPaths from 'vite-tsconfig-paths'
// https://vitejs.dev/config
export default defineConfig((env) => {
const forgeEnv = env as ConfigEnv<'renderer'>
const { root, mode } = forgeEnv
const nodeEnv = process.env.NODE_ENV || 'production'
return {
root,
mode,
base: './',
define: {
TARGET_PLATFORM: JSON.stringify(process.platform),
'process.env.NODE_ENV': JSON.stringify(nodeEnv),
// fix for react-is lib in packaged mode
process: JSON.stringify({
env: {
NODE_ENV: nodeEnv,
},
}),
},
build: {
target: 'esnext',
outDir: `resources/browser`,
sourcemap: 'inline',
lib: {
entry: 'src/recorder/browser/index.ts',
formats: ['iife'],
name: '__k6_studio_cdp__',
fileName: () => 'index.js',
},
rollupOptions: {
output: {
preserveModules: false,
minifyInternalExports: false,
},
treeshake: 'safest',
preserveEntrySignatures: 'strict',
},
},
plugins: [
react({
jsxImportSource: '@emotion/react',
}),
tsconfigPaths(),
],
resolve: {
preserveSymlinks: true,
// Force vite to use browser-specific package exports
conditions: ['browser', 'import', 'module', 'default'],
},
clearScreen: false,
} as UserConfig
})