Skip to content

build(dev): add opt-in ORCA_DEV_BUNDLED=1 for Vite bundled renderer dev mode - #33433

Merged
nwparker merged 2 commits into
mainfrom
nwparker/renderer-bundled-dev
Oct 25, 2026
Merged

nwparker merged 2 commits into
mainfrom
nwparker/renderer-bundled-dev

Conversation

@nwparker

@nwparker nwparker commented Oct 25, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 0 0 0 0
Prod 3 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​62 $\color{#cf222e}{\Huge{\mathbf{−}}}$​17 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​45

Summary

This adds an opt-in ORCA_DEV_BUNDLED=1 setting for pnpm dev. It runs the renderer in Vite's experimental bundled dev mode (experimental.bundledDev, available in the installed Vite 8.3.4). In this mode the renderer loads as a few bundled chunks instead of ~2–3k separate module requests. It is off by default, so normal pnpm dev is unchanged.

  • config/build-plugins/renderer-bundled-dev.ts: when the variable is set, enables experimental.bundledDev on the renderer config and sets build.rollupOptions.output.strictExecutionOrder: true.
  • config/build-plugins/dev-serve-config.ts: applies it on the serve path only. Production builds are unaffected.
  • .github/CONTRIBUTING.md: how to use it, plus known caveats.

Why strictExecutionOrder

If you enable bundled dev alone, the renderer never mounts. It throws @vitejs/plugin-react can't detect preamble. The React Refresh preamble is inlined into the index entry chunk, but the four HTML entries (index, popout, space, web) share chunks, and those chunks run before the entry's preamble. Strict execution order keeps the original module order, and the app renders normally.

Measurements

How it was measured: full Electron dev app, launched in the background with ORCA_BACKGROUND_LAUNCH=1, a fresh profile each run, and timing over CDP. "Ready" means workspaceSessionReady plus a rendered #root. The timer starts when Electron's renderer target appears, which excludes the main/preload build that is the same in both modes. The machine was heavily loaded (load average 35–60), so the numbers are noisy. Medians of 4 interleaved warm runs:

Default dev ORCA_DEV_BUNDLED=1
Renderer start to first full render (warm cache) 10.9 s 3.5 s
Same, cold (renderer cache deleted) 24.3 s 4.1 s
In-page time to first render (performance.now()) 10.8 s 1.6 s
Full reload (wall) 3.1 s 2.6 s
Full reload (in-page) 3.1 s 1.4 s
Resource requests on load 250+ (buffer full) ~25

In bundled mode the first reload after start takes ~3.5 s, because the server regenerates the bundle. Later reloads take 0.5–0.7 s.

Validation in bundled mode

  • HMR: a TSX edit (Landing.tsx) updated the DOM in 0.9–1.8 s and kept window state (no full reload). A main.css edit applied in 1.7–3.1 s and also kept state. Default mode took 2.2–3.2 s and 4.3–4.8 s for the same edits.
  • Plugins:
    • React + Fast Refresh: works with the fix above.
    • Tailwind: CSS renders and hot-updates.
    • pdfjs viewer asset middleware: standard_fonts returns 200.
    • Markdown parser aliases: markdown renders in the rich editor.
    • Cache-retention plugin: starts and stops cleanly.
  • Workers: Monaco opened a .ts file, and editor.worker and ts.worker loaded.
  • Other entries: popout.html, space.html, and web-index.html serve their bundled entries with 200.
  • Screenshots taken over CDP from the hidden window show the full app shell, Monaco, and the markdown editor rendering normally.
  • No console errors or page errors in any run.

Known caveats (documented in CONTRIBUTING)

  • Experimental. Each edit rebuilds the affected chunks.
  • While a rebuild is pending, newly requested HTML for the pop-out, space, or web windows may be placeholder HTML until the bundle is ready.

Checks

  • pnpm tc passes.
  • pnpm run check:code-quality:changed passes.
  • oxlint is clean on the changed files.
  • oxfmt is clean.

…ev mode

Serves the renderer through Vite's experimental bundled dev mode when the
variable is set. Strict execution order keeps the React Refresh preamble ahead
of chunks shared by the four HTML entries. Default dev behavior is unchanged.
@nwparker
nwparker marked this pull request as ready for review October 25, 2026 06:23
@coderabbitai

coderabbitai Bot commented Oct 25, 2026 •

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 1 minute.

Check out review usage here.

View limit details

Limit details: You’ve used all 10 included reviews currently available.

Learn how review limits work.

Review configuration:

Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 13c59047-2834-4601-915e-2f75126eed3c
Commits

Reviewing files that changed from the base of the PR and between b1e18d8 and 61cac20.

Files selected for processing: 3
  • .github/CONTRIBUTING.md
  • config/build-plugins/dev-serve-config.ts
  • config/build-plugins/renderer-bundled-dev.ts
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@nwparker
nwparker merged commit f66c4c0 into main Oct 25, 2026
38 checks passed
@nwparker
nwparker deleted the nwparker/renderer-bundled-dev branch October 25, 2026 06:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant