Skip to content

Commit 9bed1b4

Browse files
authored
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
1 parent 30c606e commit 9bed1b4

3 files changed

Lines changed: 9 additions & 9 deletions

File tree

‎.github/CONTRIBUTING.md‎

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -118,13 +118,10 @@ In PowerShell, use `$env:ORCA_DEV_MAIN_SOURCEMAPS='0'` before `pnpm dev`.
118118
Remove the variable when debugging the main process with source maps. Renderer and
119119
preload settings are unaffected; production builds always keep their hidden main maps.
120120
121-
To try Vite's experimental bundled dev mode for the renderer, set `ORCA_DEV_BUNDLED=1`
122-
before `pnpm dev` (PowerShell: `$env:ORCA_DEV_BUNDLED='1'`). The renderer is served as a
123-
few bundled chunks instead of thousands of module requests, so the first render and full
124-
reloads are faster. HMR still works, but each edit rebuilds the affected chunks. While a
125-
rebuild is pending, a newly opened pop-out, space, or web window may get placeholder HTML
126-
until the bundle is ready. The mode is opt-in and experimental. Unset the variable if the renderer
127-
misbehaves, and report the problem with the variable noted.
121+
`pnpm dev` serves the renderer with Vite's bundled dev mode: a few bundled chunks instead of
122+
thousands of module requests, so the first render and full reloads are faster. While a rebuild is
123+
pending, a newly opened pop-out, space, or web window may briefly get placeholder HTML. If the
124+
renderer misbehaves, set `ORCA_DEV_BUNDLED=0` (PowerShell: `$env:ORCA_DEV_BUNDLED='0'`) and report it.
128125
129126
Local installs use pnpm's global virtual store: each package version is one slot
130127
under `~/pnpm/store` that every worktree links to, instead of a full `node_modules` per worktree.

‎config/build-plugins/renderer-bundled-dev.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
import type { UserConfig } from 'electron-vite'
22

33
/**
4-
* Opt-in (`ORCA_DEV_BUNDLED=1`): Vite's experimental bundled dev mode serves the renderer as
4+
* Default in dev (opt out with `ORCA_DEV_BUNDLED=0`): Vite's bundled dev mode serves the renderer as
55
* bundled chunks instead of thousands of per-module requests, which shortens dev startup and reloads.
66
*/
77
export function withBundledRendererDev(
88
config: UserConfig,
99
env: NodeJS.ProcessEnv = process.env
1010
): UserConfig {
1111
const renderer = config.renderer
12-
if (env.ORCA_DEV_BUNDLED !== '1' || !renderer || typeof renderer === 'function') {
12+
if (env.ORCA_DEV_BUNDLED === '0' || !renderer || typeof renderer === 'function') {
1313
return config
1414
}
1515
const rollupOptions = renderer.build?.rollupOptions

‎config/scripts/electron-vite-output-contract.test.ts‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,10 +110,13 @@ describe('Electron Vite output contract', () => {
110110
it('can skip main source maps during development without changing build output settings', () => {
111111
try {
112112
vi.stubEnv('ORCA_DEV_MAIN_SOURCEMAPS', undefined)
113+
vi.stubEnv('ORCA_DEV_BUNDLED', undefined)
113114
const defaults = configureElectronVite({ command: 'serve', mode: 'development' })
114115
expect(defaults.main?.build?.sourcemap).toBe('hidden')
115116
expect(defaults.main?.build?.minify).toBe(false)
117+
expect(defaults.renderer?.experimental?.bundledDev).toBe(true)
116118
vi.stubEnv('ORCA_DEV_MAIN_SOURCEMAPS', '0')
119+
vi.stubEnv('ORCA_DEV_BUNDLED', '0')
117120
const development = configureElectronVite({ command: 'serve', mode: 'development' })
118121
expect(development.main?.build?.sourcemap).toBe(false)
119122
expect(development.main?.build?.minify).toBe(false)

0 commit comments

Comments
 (0)