Repository navigation
fix(cli): Bundle simple-plist's requires so the Apple and RN wizards start - #2603
Merged
Merged
Conversation
…start
`sentry wizard reactNative`, `ios`, and `appleSnapshots` crashed on start
from the npm package ("Cannot find module 'bplist-creator'") and the
binary ("No such built-in module: bplist-creator").
`xcode` requires `simple-plist`, whose files are TypeScript UMD modules
that call a `require` parameter: `factory(require, exports)`. esbuild
only bundles calls to the free `require`, so it left them as runtime
requires that neither artifact can satisfy. A new esbuild plugin renames
the parameter so esbuild bundles them, and fails the build if the UMD
header disappears.
An e2e test starts every wizard from the built npm bundle and fails on a
missing module.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
1 Skipped Deployment
|
antonis
marked this pull request as ready for review
November 30, 2026 13:53
BYK
approved these changes
Nov 30, 2026
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes getsentry/sentry-react-native#7148.
sentry wizard reactNative,ios, andappleSnapshotscrash as soon as they start, before changing any file:dist/bin.cjs):Error: Cannot find module 'bplist-creator'Error [ERR_UNKNOWN_BUILTIN_MODULE]: No such built-in module: bplist-creatorRunning from source works, because the module resolves from the monorepo's
node_modules, so unit tests didn't catch it.Root cause
xcode(imported at module load by the Apple and React Native wizards) requiressimple-plist. Every file insimple-plist/dist/is a TypeScript UMD module that calls arequireit receives as a parameter:esbuild only bundles calls to the free
require, so these stay runtime requires (m("bplist-creator")in the built chunk). The npm package ships no dependencies and the binary can onlyrequirebuilt-ins, so both fail.Key Changes
umdRequirePlugin(packages/cli/script/lib/umd-require-plugin.ts), registered inscript/bundle.tsandscript/build.ts. It renames the factory'srequireparameter insimple-plist's files, so the calls inside use the module'srequireand esbuild bundles them. If a matched file no longer has the UMD header, the build fails rather than shipping the crash again.test/e2e/bundle.test.tsstarts every wizard that has a runner from the built npm bundle, in an empty directory with stdin closed,SENTRY_SPOTLIGHT=1, and telemetry off. It checks that the intro prints and that no module resolution error appears. Without the plugin,reactNative,ios, andappleSnapshotsfail.test/script/umd-require-plugin.test.tsbundlesxcodewith and without the plugin and loads it from outside anynode_modules.Verification
pnpm run build):reactNative,ios,appleSnapshots, andandroidstart.src,script,test) andpnpm run lintpass.🤖 Generated with Claude Code