perf(dev): serve the renderer with bundled dev mode by default (#33449)

* perf(dev): serve the renderer with bundled dev mode by default

* test(dev): expect bundled renderer dev by default
This commit is contained in:
Neil
2026-10-25 00:40:45 -07:00
committed by GitHub
parent 30c606e7ba
commit 9bed1b47aa
3 changed files with 9 additions and 9 deletions
+4 -7
View File
@@ -118,13 +118,10 @@ In PowerShell, use `$env:ORCA_DEV_MAIN_SOURCEMAPS='0'` before `pnpm dev`.
Remove the variable when debugging the main process with source maps. Renderer and
preload settings are unaffected; production builds always keep their hidden main maps.
To try Vite's experimental bundled dev mode for the renderer, set `ORCA_DEV_BUNDLED=1`
before `pnpm dev` (PowerShell: `$env:ORCA_DEV_BUNDLED='1'`). The renderer is served as a
few bundled chunks instead of thousands of module requests, so the first render and full
reloads are faster. HMR still works, but each edit rebuilds the affected chunks. While a
rebuild is pending, a newly opened pop-out, space, or web window may get placeholder HTML
until the bundle is ready. The mode is opt-in and experimental. Unset the variable if the renderer
misbehaves, and report the problem with the variable noted.
`pnpm dev` serves the renderer with Vite's bundled dev mode: a few bundled chunks instead of
thousands of module requests, so the first render and full reloads are faster. While a rebuild is
pending, a newly opened pop-out, space, or web window may briefly get placeholder HTML. If the
renderer misbehaves, set `ORCA_DEV_BUNDLED=0` (PowerShell: `$env:ORCA_DEV_BUNDLED='0'`) and report it.
Local installs use pnpm's global virtual store: each package version is one slot
under `~/pnpm/store` that every worktree links to, instead of a full `node_modules` per worktree.
+2 -2
View File
@@ -1,7 +1,7 @@
import type { UserConfig } from 'electron-vite'
/**
* Opt-in (`ORCA_DEV_BUNDLED=1`): Vite's experimental bundled dev mode serves the renderer as
* Default in dev (opt out with `ORCA_DEV_BUNDLED=0`): Vite's bundled dev mode serves the renderer as
* bundled chunks instead of thousands of per-module requests, which shortens dev startup and reloads.
*/
export function withBundledRendererDev(
@@ -9,7 +9,7 @@ export function withBundledRendererDev(
env: NodeJS.ProcessEnv = process.env
): UserConfig {
const renderer = config.renderer
if (env.ORCA_DEV_BUNDLED !== '1' || !renderer || typeof renderer === 'function') {
if (env.ORCA_DEV_BUNDLED === '0' || !renderer || typeof renderer === 'function') {
return config
}
const rollupOptions = renderer.build?.rollupOptions
@@ -110,10 +110,13 @@ describe('Electron Vite output contract', () => {
it('can skip main source maps during development without changing build output settings', () => {
try {
vi.stubEnv('ORCA_DEV_MAIN_SOURCEMAPS', undefined)
vi.stubEnv('ORCA_DEV_BUNDLED', undefined)
const defaults = configureElectronVite({ command: 'serve', mode: 'development' })
expect(defaults.main?.build?.sourcemap).toBe('hidden')
expect(defaults.main?.build?.minify).toBe(false)
expect(defaults.renderer?.experimental?.bundledDev).toBe(true)
vi.stubEnv('ORCA_DEV_MAIN_SOURCEMAPS', '0')
vi.stubEnv('ORCA_DEV_BUNDLED', '0')
const development = configureElectronVite({ command: 'serve', mode: 'development' })
expect(development.main?.build?.sourcemap).toBe(false)
expect(development.main?.build?.minify).toBe(false)