Skip to content

fix: allow --entry-file to be omitted when entry is defined in config#1348

Merged
jbroma merged 2 commits intomainfrom
fix/entry-file-required
Feb 26, 2026
Merged

fix: allow --entry-file to be omitted when entry is defined in config#1348
jbroma merged 2 commits intomainfrom
fix/entry-file-required

Conversation

@jbroma
Copy link
Member

@jbroma jbroma commented Feb 26, 2026

Summary

  • Guard the entry override in getCliOverrides so it's only set when --entry-file is actually provided, preventing a TypeError crash from normalizeEntryFile(undefined)
  • Fix the BundleArguments.entryFile type to be optional (string | undefined), matching the runtime reality that the CLI option has no default
  • Add tests for getCliOverrides covering both bundle and start command branches

Closes #1343

Details

When --entry-file is omitted from react-native bundle, bundleArgs.entryFile is undefined at runtime. The unconditional call to normalizeEntryFile(undefined) crashes with a TypeError on path.isAbsolute(undefined) before the existing validation in bundle() (if (!args.entryFile && !config.entry)) can run.

The fix guards the entry override behind an if (bundleArgs.entryFile) check, matching the existing pattern in getEnvOptions. This lets users define entry in their rspack/webpack config without needing to also pass --entry-file.

Test plan

  • New unit tests for getCliOverrides (7 tests, all passing)
  • All existing commands/common tests pass (54 tests, 10 suites)
  • @callstack/repack builds cleanly with no type errors

🤖 Generated with Claude Code

@vercel
Copy link

vercel bot commented Feb 26, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
repack-website Ready Ready Preview, Comment Feb 26, 2026 0:31am

Request Review

@changeset-bot
Copy link

changeset-bot bot commented Feb 26, 2026

🦋 Changeset detected

Latest commit: 0720abe

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 6 packages
Name Type
@callstack/repack Patch
@callstack/repack-plugin-expo-modules Patch
@callstack/repack-plugin-nativewind Patch
@callstack/repack-plugin-reanimated Patch
@callstack/repack-dev-server Patch
@callstack/repack-init Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@jbroma jbroma changed the title fix: allow --entry-file to be omitted when entry is defined in config fix: allow --entry-file to be omitted when entry is defined in config Feb 26, 2026
…tted

When --entry-file is not provided, bundleArgs.entryFile is undefined at
runtime. The unconditional call to normalizeEntryFile(undefined) crashes
with a TypeError before the validation in bundle() can check whether
entry is defined in the user's config.

Guard the entry override behind an if-check (matching the existing
pattern in getEnvOptions) so that omitting --entry-file lets the
user's config-defined entry take effect as documented.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@jbroma jbroma force-pushed the fix/entry-file-required branch from e37b4f7 to 0720abe Compare February 26, 2026 12:30
@jbroma jbroma merged commit cc943dd into main Feb 26, 2026
6 checks passed
@jbroma jbroma deleted the fix/entry-file-required branch February 26, 2026 12:34
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.

--entry-file required even when entry is defined in config

1 participant