Skip to content

fix: throw a descriptive error when the out dir would exclude the app from packaging#1928

Open
claude[bot] wants to merge 2 commits into
mainfrom
fix/out-dir-contains-entry-point
Open

fix: throw a descriptive error when the out dir would exclude the app from packaging#1928
claude[bot] wants to merge 2 commits into
mainfrom
fix/out-dir-contains-entry-point

Conversation

@claude

@claude claude Bot commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

Requested by Samuel Attard · Slack thread

  • I have read the contribution documentation for this project.
  • I agree to follow the code of conduct that this project follows, as appropriate.
  • The changes are appropriately documented (if applicable).
  • The changes have sufficient test coverage (if applicable).
  • The testsuite passes successfully on my local machine (if applicable).

Summarize your changes:

Before: if the out directory resolved to a location inside the app source — e.g. main: "dist/code.js" in package.json with --out ./dist, or --out pointing at the app directory itself — the out directory was silently excluded from the copy (out dirs are always excluded from packaging), and the user got a misleading error blaming their ignore option: The main entry point to your app was not found. Make sure "..." exists and does not get ignored by your ignore option (or the Application manifest was not found variant when out equals dir).

After: packaging fails with a targeted error that explains the actual problem, e.g.:

The out directory (/path/to/app/dist) is inside your app directory and contains your app's main entry point (/path/to/app/dist/code.js). The out directory is automatically excluded from packaging; choose an out directory outside of your app directory

and, when out is the app directory itself:

The out directory (/path/to/app) is the same as your app directory. The out directory is automatically excluded from packaging, so nothing would be packaged; choose an out directory outside of your app directory

How: App.buildApp (src/platform.ts) now passes the resolved ignored out dirs (from generateIgnoredOutDirs in src/copy-filter.ts) into validateElectronApp (src/common.ts). When validation fails and the missing manifest/main entry point falls inside an ignored out dir, the new targeted error is thrown instead of the generic one; behavior is unchanged for every configuration that packages successfully today. Covered by new unit tests in test/common.spec.ts (plus a new fixture) and end-to-end tests in test/packager.spec.ts for both the out-dir-contains-main-entry-point and out-equals-dir cases.

Fixes #1685

claude added 2 commits July 3, 2026 19:30
… from packaging

Out directories are automatically excluded from the packaged app. When
the out dir is the app dir itself, or is a subdirectory of the app dir
that contains the app's main entry point, packaging failed with a
misleading "Application manifest was not found" or "The main entry
point to your app was not found" error that blamed the ignore option.

validateElectronApp now receives the resolved ignored out dirs and
throws a targeted error explaining that the out dir is excluded from
packaging and must live outside the app source.

Fixes #1685
Use realpath-canonicalized paths and a path.relative-based containment
check so the out-dir detection works across symlinked paths (e.g. /var
vs /private/var in macOS tmpdirs) and case-insensitive filesystems.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RX3wGLrrpx1fBfqXCZt1Tx
@claude claude Bot force-pushed the fix/out-dir-contains-entry-point branch from 993460d to 58f5670 Compare July 3, 2026 19:30
@MarshallOfSound MarshallOfSound marked this pull request as ready for review July 3, 2026 19:33
@MarshallOfSound MarshallOfSound requested a review from a team as a code owner July 3, 2026 19:33
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.

Incorrect error message when --out is set to the folder containing the entry point

2 participants