-
Notifications
You must be signed in to change notification settings - Fork 21
Expand file tree
/
Copy pathvite.renderer.config.ts
More file actions
57 lines (54 loc) · 1.61 KB
/
vite.renderer.config.ts
File metadata and controls
57 lines (54 loc) · 1.61 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
import { sentryVitePlugin } from '@sentry/vite-plugin'
import react from '@vitejs/plugin-react'
import type { ConfigEnv, UserConfig } from 'vite'
import { defineConfig } from 'vite'
import tsconfigPaths from 'vite-tsconfig-paths'
import { version } from './package.json'
import { pluginExposeRenderer } from './vite.base.config'
// https://vitejs.dev/config
export default defineConfig((env) => {
const forgeEnv = env as ConfigEnv<'renderer'>
const { root, mode, forgeConfigSelf } = forgeEnv
const name = forgeConfigSelf.name ?? ''
return {
root,
mode,
base: './',
build: {
outDir: `.vite/renderer/${name}`,
sourcemap: true,
// Electron always ships a current Chromium; avoid esbuild's legacy
// browser targets (chrome87, …) which break dep pre-bundling for
// packages that use destructuring + rest (e.g. @radix-ui/react-select).
target: 'esnext',
},
optimizeDeps: {
esbuildOptions: {
target: 'esnext',
},
},
plugins: [
react({
jsxImportSource: '@emotion/react',
}),
pluginExposeRenderer(name),
tsconfigPaths(),
sentryVitePlugin({
authToken: process.env.SENTRY_AUTH_TOKEN,
org: process.env.SENTRY_ORG,
project: process.env.SENTRY_PROJECT,
}),
],
resolve: {
preserveSymlinks: true,
},
define: {
__APP_VERSION__: JSON.stringify(version),
GRAFANA_COM_URL: JSON.stringify(
process.env.GRAFANA_COM_URL ?? 'https://grafana.com'
),
TARGET_PLATFORM: JSON.stringify(process.platform),
},
clearScreen: false,
} as UserConfig
})