Repository navigation
Conversation
`STORYBOOK_ENABLED=true react-native bundle`, which is also what Xcode and Gradle run for release builds, shipped the app instead of Storybook: the swap lived only in `resolver.resolveRequest`, and Metro does not ask the resolver about the entry when it is building. It now also happens in a transform worker that chains to whichever worker the app had configured, resolved the way Metro resolves it, so `start`, `bundle` and native release builds all produce the Storybook app. Fixes #944 (cherry picked from commit aeddb44)
🦋 Changeset detectedLatest commit: 8f1b853 The changes in this PR will be included in the next version bump. This PR includes changesets to release 9 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
…dle-entry-swap-v10
Member
Author
|
leave it for v11 |
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.
Issue: #944
What I did
Backport of #951 to
v10-stable.STORYBOOK_ENABLED=true react-native bundle, and therefore bare React Native release builds, shipped the app instead of Storybook. Metro's build path never callsresolveRequestfor the entry.withStorybooknow also sets a MetrotransformerPathworker that swaps the app entry at transform time. It chains to the existing worker, and it resolves Metro's default worker the wayreact-native bundleloads it. See #951 for details.Conflicts, all small:
tests/package.jsonkeeps v10's test file list and adds the newbundleEntrySwaptest.next. Metro 0.84.6 was already resolved here.How to test
pnpm -F @storybook/tests test: thebundleEntrySwape2e test, a realMetro.runBuild, fails onv10-stable(5 of 6) and passes here.@storybook/react-native10.7.0 with this branch'sdist:STORYBOOK_ENABLED=true npx react-native bundle --entry-file index.js --platform ios --dev true --bundle-output /tmp/sb.jsgives the Storybook bundle (before: the app).Typecheck, lint, Prettier,
pnpm testandpnpm --filter expo-example checkall pass.