Skip to content

fix(cli): Bundle simple-plist's requires so the Apple and RN wizards start - #2603

Merged
BYK merged 1 commit into
mainfrom
antonis/fix-wizard-bplist-creator
Nov 30, 2026
Merged

BYK merged 1 commit into
mainfrom
antonis/fix-wizard-bplist-creator

Conversation

@antonis

@antonis antonis commented Nov 30, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes getsentry/sentry-react-native#7148.

sentry wizard reactNative, ios, and appleSnapshots crash as soon as they start, before changing any file:

  • npm package (dist/bin.cjs): Error: Cannot find module 'bplist-creator'
  • Single-file binary: Error [ERR_UNKNOWN_BUILTIN_MODULE]: No such built-in module: bplist-creator

Running 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) requires simple-plist. Every file in simple-plist/dist/ is a TypeScript UMD module that calls a require it receives as a parameter:

(function (factory) { … var v = factory(require, exports); … })
(function (require, exports) {
    var bplist_creator_1 = __importDefault(require("bplist-creator"));
    var parse_1 = require("./parse");

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 only require built-ins, so both fail.

Key Changes

  • New umdRequirePlugin (packages/cli/script/lib/umd-require-plugin.ts), registered in script/bundle.ts and script/build.ts. It renames the factory's require parameter in simple-plist's files, so the calls inside use the module's require and 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.ts starts 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, and appleSnapshots fail.
  • test/script/umd-require-plugin.test.ts bundles xcode with and without the plugin and loads it from outside any node_modules.

Verification

  • npm bundle: all 11 wizards with a runner start.
  • macOS arm64 binary (pnpm run build): reactNative, ios, appleSnapshots, and android start.
  • CLI typecheck (src, script, test) and pnpm run lint pass.

🤖 Generated with Claude Code

…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>
@vercel

vercel Bot commented Nov 30, 2026 •

Copy link
Copy Markdown

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

Project Deployment Actions Updated
cli Ready Ready Preview Nov 30, 2026 1:46pm UTC
1 Skipped Deployment
Project Deployment Actions Updated
sentry-local Skipped Skipped Nov 30, 2026 1:46pm UTC

Request Review

@antonis
antonis marked this pull request as ready for review November 30, 2026 13:53
@github-actions github-actions Bot added the risk: medium PR risk score: medium label Nov 30, 2026
@BYK
BYK added this pull request to the merge queue Nov 30, 2026
Merged via the queue into main with commit 2b74c1f Nov 30, 2026
29 checks passed
@BYK
BYK deleted the antonis/fix-wizard-bplist-creator branch November 30, 2026 14:07

This branch was successfully deployed

1 active and 1 inactive deployments
Preview – cli — a5573d8f Deployed Nov 30, 2026 by vercel[bot]
Preview – sentry-local — a5573d8f Deployed Nov 30, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

risk: medium PR risk score: medium

Projects

None yet

Development

Successfully merging this pull request may close these issues.

sentry wizard reactNative and ios crash on start: Cannot find module 'bplist-creator'

2 participants