Skip to content

Fix CLI bundle output options and missing iOS asset catalog failures - #59885

Open
NansKong wants to merge 1 commit into
react:mainfrom
NansKong:fix/cli-bundle-output
Open

NansKong wants to merge 1 commit into
react:mainfrom
NansKong:fix/cli-bundle-output

Conversation

@NansKong

@NansKong NansKong commented Nov 9, 2026

Copy link
Copy Markdown

Summary:

Fixes #59871 and #59873.

  • Reject asset saving when a requested iOS RNAssets.xcassets catalog is missing, so the bundle command exits nonzero instead of reporting success with missing assets.
  • Pass bundleEncoding and sourcemapSourcesRoot to the output writer through Metro's documented output adapter. This retains runBuild and custom output implementations while restoring the advertised CLI options.
  • Add regression coverage for missing/valid catalogs, loose asset copying, UTF-16LE and default UTF-8 bytes, ordinary/indexed source maps, and custom output implementations.

Reproducer project: https://github.com/NansKong/react-native-cli-bundle-reproducer

Changelog:

[GENERAL] [FIXED] - Honor --bundle-encoding and --sourcemap-sources-root when writing CLI bundles.

[IOS] [FIXED] - Fail bundling when the requested iOS asset catalog is missing.

Test Plan:

  • yarn test packages/community-cli-plugin/src/commands/bundle/__tests__ --runInBand --cacheDirectory <short-local-cache>: 6 suites, 26 tests passed. Used short local TEMP/cache paths to avoid Windows sandbox path-length restrictions.
  • node node_modules/eslint/bin/eslint.js --max-warnings 0 on the four changed files: passed.
  • node node_modules/prettier/bin/prettier.cjs --check on the four changed files: passed.
  • node node_modules/flow-bin/cli.js check --timeout 60 --temp-dir <local-flow-temp> --quiet: No errors.
  • git diff --check: passed.
  • Compiled the two changed main source files into the CLI package in the linked template app (React Native 0.88.1 / Metro 0.87.2), then ran a public-CLI verification harness:
    • Control bundle exits 0.
    • Missing catalog exits 1 with the actionable catalog error.
    • Requested UTF-16LE bytes equal the expected encoding of the control bundle.
    • Source map contains the relative entry path and no absolute source paths.

Tested on Windows with Node 22.22.0. Native builds/devices and other host operating systems were not tested.

Copilot AI balanced review requested due to automatic review settings November 9, 2026 14:06
@meta-cla

meta-cla Bot commented Nov 9, 2026

Copy link
Copy Markdown

Hi @NansKong!

Thank you for your pull request and welcome to our community.

Action Required

In order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you.

Process

In order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA.

Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with CLA signed. The tagging process may take up to 1 hour after signing. Please give it that time before contacting us about it.

If you have received this in error or have any questions, please contact us at cla@meta.com. Thanks!

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Nov 9, 2026
@meta-cla

meta-cla Bot commented Nov 9, 2026

Copy link
Copy Markdown

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Meta Open Source project. Thanks!

@facebook-github-tools facebook-github-tools Bot added the Shared with Meta Applied via automation to indicate that an Issue or Pull Request has been shared with the team. label Nov 9, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. Shared with Meta Applied via automation to indicate that an Issue or Pull Request has been shared with the team.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[CLI] Missing iOS asset catalog reports success and skips all asset copying

2 participants