Skip to content

fix(package): keep cached dev Electron bundles out of app.asar - #15359

Merged
nwparker merged 1 commit into
mainfrom
nwparker/exclude-dev-bundles-from-package
Aug 18, 2026
Merged

nwparker merged 1 commit into
mainfrom
nwparker/exclude-dev-bundles-from-package

Conversation

@nwparker

@nwparker nwparker commented Aug 18, 2026 •

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

ELI5

pnpm dev leaves a ~270MB copy of Electron.app in out/electron-dev for every branch you build. If you packaged the app on that same machine, all of those copies got stuffed into the shipped app.asar. One line tells electron-builder to skip that directory.

What Changed

  • config/electron-builder.config.cjs: added '!out/electron-dev{,/**/*}' to files.
  • config/scripts/electron-builder-config.test.mjs: a matcher-driven test that dev bundle paths are excluded while out/main and out/renderer still pack.

Why

files is an all-negation list, so electron-builder's default **/* packs anything without an explicit ! entry. out/ is gitignored, but electron-builder globs the filesystem, not git — so out/electron-dev/<hash>/Orca: dev.app/** was fair game.

This is the same shape as the examples/ miss that shipped hostile-panel in 1.4.160-rc.3, which is why the test drives the real FileMatcher instead of pinning the pattern string: asserting the glob exists cannot prove it excludes the tree.

Release builds were never affected — CI runners never run pnpm dev, so out/electron-dev does not exist there. The exposure is local packaging only (pnpm build:mac / build:unpack on a dev machine), where it showed up as silent bulk rather than a failure.

Noticed while reviewing #15247, which prunes stale bundles from that same directory and so already shrank the worst case.

Linked Issue

No separate issue — follow-up to #15247.

Visual Proof

N/A — packaging input filter only. No runtime code, UI, or user-visible behavior changes.

Testing

pnpm exec vitest run config/scripts/electron-builder-config.test.mjs → 34 passed.

Mutation-verified: with the !out/electron-dev{,/**/*} line removed, the new test fails; restored, it passes. Without that step the test would pass either way.

Also clean: oxlint, oxfmt --check, check:max-lines-ratchet.

Not run locally: a full pnpm build:mac. The assertion is on electron-builder's own FileMatcher with the real config, which is the component that decides packing.

  • I manually tested these changes locally
  • Automated tests added/updated, or explained why not below

`files` is an all-negation list, so electron-builder's default `**/*` packs
anything without an explicit `!` entry. out/electron-dev holds `pnpm dev`'s
per-branch Electron.app copies (~270MB each), so packaging on a machine that
has run dev bundled them all. CI never creates the directory, so releases were
never affected.
@nwparker
nwparker merged commit a3edabc into main Aug 18, 2026
51 checks passed
@coderabbitai

coderabbitai Bot commented Aug 18, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: d2014fc6-eb06-4883-b011-76b0ea6e8093

📥 Commits

Reviewing files that changed from the base of the PR and between 4b0e01f and ab7a7f0.

📒 Files selected for processing (2)
  • config/electron-builder.config.cjs
  • config/scripts/electron-builder-config.test.mjs

📝 Walkthrough

Walkthrough

The Electron Builder configuration now excludes out/electron-dev and all nested contents from packaged applications. A regression test checks that cached development Electron bundles are absent from app.asar. The test also checks that the standard out/main and out/renderer outputs remain included.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch

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.

paidaxingyo666 pushed a commit to paidaxingyo666/Manta that referenced this pull request Aug 21, 2026
…yai#15359)

`files` is an all-negation list, so electron-builder's default `**/*` packs
anything without an explicit `!` entry. out/electron-dev holds `pnpm dev`'s
per-branch Electron.app copies (~270MB each), so packaging on a machine that
has run dev bundled them all. CI never creates the directory, so releases were
never affected.
dallascrilley pushed a commit to dallascrilley/orca that referenced this pull request Aug 27, 2026
…yai#15359)

`files` is an all-negation list, so electron-builder's default `**/*` packs
anything without an explicit `!` entry. out/electron-dev holds `pnpm dev`'s
per-branch Electron.app copies (~270MB each), so packaging on a machine that
has run dev bundled them all. CI never creates the directory, so releases were
never affected.
enrick-dev pushed a commit to enrick-dev/orca that referenced this pull request Oct 15, 2026
…yai#15359)

`files` is an all-negation list, so electron-builder's default `**/*` packs
anything without an explicit `!` entry. out/electron-dev holds `pnpm dev`'s
per-branch Electron.app copies (~270MB each), so packaging on a machine that
has run dev bundled them all. CI never creates the directory, so releases were
never affected.
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