Repository navigation
chore(storybook): repair yarn storybook for the on-device 6.5 flow; keep core-js out of inline requires - #726
Merged
Merged
Conversation
…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]>
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.
Why
Tester finding 21:
yarn storybookranstart-storybook -p 9001, the Storybook web CLI, which is not installed. The project uses@storybook/react-native6.5 (on-device UI,sb-rn-get-stories/sb-rn-watcher), with@storybook/react7.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 theSHOW_STORYBOOKtoggle inindex.js, the command, launching or reloading the app, andyarn storybook-watcher.metro.config.js: with Storybook enabled the app died on boot withMaximum call stack size exceededinside core-js'sArray.prototype.slicepolyfill (screenshot on the Buzz issue). core-js comes from@storybook/client-api; Metro'sinlineRequiresmakes core-js internals resolve lazily after the polyfill has replaced the native method, so the polyfill recurses. core-js is now excluded from inlining viainlineRequires.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-native7.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-webpack4wantswebpack-dev-middleware ^3.7.3and the hoisted copy is 5.3.4. Not touched.Validation
yarn get-storieson main leavesstorybook.requires.jsunchanged (index is current).node -e 'require("./metro.config.js")'loads; blockList resolves 3684 core-js files.Buzz issue:
fd52446f6e74c7d571ba5ee0c275819ad16606bd57bd6c08bd19e5f3dd108850🤖 Generated with Claude Code