Skip to content

chore(storybook): repair yarn storybook for the on-device 6.5 flow; keep core-js out of inline requires - #726

Merged
islandbitcoin merged 2 commits into
mainfrom
fix/storybook-command
Sep 23, 2026
Merged

islandbitcoin merged 2 commits into
mainfrom
fix/storybook-command

Conversation

@islandbitcoin

Copy link
Copy Markdown
Contributor

Why

Tester finding 21: yarn storybook ran start-storybook -p 9001, the Storybook web CLI, which is not installed. The project uses @storybook/react-native 6.5 (on-device UI, sb-rn-get-stories / sb-rn-watcher), with @storybook/react 7.0.7 only as a transitive type/test dependency.

What

  • package.json: "storybook": "yarn get-stories && yarn start", the launch path the installed RN Storybook 6.5 supports (regenerate the story index, start Metro). No dependency changes.
  • README.md "Running Storybook": documents the SHOW_STORYBOOK toggle in index.js, the command, launching or reloading the app, and yarn storybook-watcher.
  • metro.config.js: with Storybook enabled the app died on boot with Maximum call stack size exceeded inside core-js's Array.prototype.slice polyfill (screenshot on the Buzz issue). core-js comes from @storybook/client-api; Metro's inlineRequires makes core-js internals resolve lazily after the polyfill has replaced the native method, so the polyfill recurses. core-js is now excluded from inlining via inlineRequires.blockList. Nothing in the normal app bundle requires core-js, so the app bundle is unchanged.

Status against the issue

The documented command now starts the right tooling, and the boot crash is fixed, but a story still does not render on a simulator at this commit: after the core-js fix the Storybook root fails in typesafe-i18n at new Intl.PluralRules(locale) with "Cannot read property 'prototype' of undefined", while the normal app constructs the same object fine on the same Hermes build. That points at core-js 3 (Storybook 6.5's dependency) altering globals under Hermes. Fixing it means either upgrading to @storybook/react-native 7.x/8.x (which dropped core-js) or isolating polyfills, both beyond "avoid broad dependency upgrades". Left for a follow-up decision.

The browser server (sb-server) is separately broken: @storybook/manager-webpack4 wants webpack-dev-middleware ^3.7.3 and the hoisted copy is 5.3.4. Not touched.

Validation

  • yarn get-stories on main leaves storybook.requires.js unchanged (index is current).
  • node -e 'require("./metro.config.js")' loads; blockList resolves 3684 core-js files.
  • Simulator (iPhone 17, debug build 0.7.1 (54), Metro from this branch): normal app renders Get Started; Storybook mode moves from the stack-overflow boot crash to the i18n render error described above.

Buzz issue: fd52446f6e74c7d571ba5ee0c275819ad16606bd57bd6c08bd19e5f3dd108850

🤖 Generated with Claude Code

…keep core-js out of inline requires

`yarn storybook` invoked `start-storybook`, the web Storybook CLI, which
is not installed (the project has @storybook/react-native 6.5 with the
on-device UI). It now regenerates .storybook/storybook.requires.js via
sb-rn-get-stories and starts Metro; the README describes the toggle in
index.js and the launch steps.

With Storybook enabled the app died on boot with "Maximum call stack
size exceeded" in core-js's Array.prototype.slice polyfill: core-js is
pulled in by @storybook/client-api, and Metro's inline requires make its
internals resolve after the polyfill has replaced the native method, so
the polyfill calls itself. Exclude core-js from inlining. Nothing in the
normal app bundle requires core-js, so the app path is unchanged.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
CI lints only added lines and flags any new require() under
@typescript-eslint/no-var-requires. metro.config.js is CommonJS by
necessity, so mark the line the same way the storybook root marks its
unresolvable import.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
@islandbitcoin
islandbitcoin merged commit 2697a88 into main Sep 23, 2026
9 checks passed
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.

2 participants