fix(react-native): preserve wrapped Expo static exports - #4799
Merged
Merged
Conversation
marandaneto
marked this pull request as ready for review
September 5, 2026 06:53
marandaneto
requested review from
a team,
ablaszkiewicz,
cat-ph and
hpouillot
September 5, 2026 06:53
Contributor
|
Reviews (1): Last reviewed commit: "fix(react-native): preserve wrapped Expo..." | Re-trigger Greptile |
ioannisj
approved these changes
Sep 7, 2026
dustinbyrne
approved these changes
Sep 7, 2026
dustinbyrne
left a comment
Contributor
There was a problem hiding this comment.
The early static-export return preserves Expo serialization and per-asset instrumentation. No conflict found with the downstream exception-stack contracts; sdk-specs does not directly specify Metro serialization.
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.
Problem
Follow-up to the Expo compatibility issue deferred in #4778.
Wrapping Expo's serializer with
createPostHogMetroSerializer()breaks static exports. Those exports can return assets or JSON rather than a single{ code, map }bundle. The wrapper tries to read them as JavaScript and throws.An output-only guard is not enough. The wrapper first injects a placeholder module, which causes Expo's PostHog per-asset hook to skip the real Chunk ID. Returning the output afterward would preserve that placeholder.
The standard
getPostHogExpoConfig()setup does not install this wrapper and is not affected by this particular composition bug.Changes
getPostHogExpoConfig().posthog-react-nativepatch changeset.This is a focused Expo static-export fix. It does not add generic support for arbitrary custom serializers that return assets without identifying a static export.
Validation
pnpm turbo --filter=posthog-react-native buildpassed.942a0d2b7againstorigin/mainfound no actionable issues.The real-serializer checks used an isolated fixture with
@expo/metro-config@0.20.17and Metro 0.82.5 because the workspace's Expo/Metro development dependency combination cannot load that serializer. The fixture is not part of this PR. Validation ran on Node 24.18.1. No real app export, Hermes compilation, or EAS Update upload was performed.Release info Sub-libraries affected
Libraries affected
Checklist
If releasing new changes
🤖 Agent context
Autonomy: Human-driven (agent-assisted)
Implemented with the Pi coding agent using GitHub CLI, Vitest, and isolated autoreview. The investigation confirmed that an output-only pass-through could ship a placeholder ID, so this change delegates before injection instead. Local investigation artifacts are excluded from the PR. Human review is required.