Skip to content

Commit

Permalink
fix(metro-config): Exclude `beforeAssetSerializationPlugins.preModule…
Browse files Browse the repository at this point in the history
…s` from `stableChunkSource` (expo#33344)

# Why

<!--
Please describe the motivation for this PR, and link to relevant GitHub
issues, forums posts, or feature requests.
-->

Sentry user reported issue with using bundle splitting and
`beforeAssetSerializationPlugins` (used by Sentry Expo Metro Plugin).
The issue is the `stableChunkSource` becomes unstable due to updated
`premodules` by the `beforeAssetSerializationPlugins`

getsentry/sentry-react-native#4317

# How

<!--
How did you build this feature or fix this bug and why?
-->

This PR ensures the updated `premodules` are not affecting the chunk
global `premodules` but only the serialized output.

# Test Plan

<!--
Please describe how you tested this change and how a reviewer could
reproduce your test, especially if this PR does not include automated
tests! If possible, please also provide terminal output and/or
screenshots demonstrating your test/reproduction.
-->

I've added multiple scenarios to the tests to ensure this regression is
avoided in the future.

I also tried running the fix with
https://github.com/getsentry/sentry-react-native/tree/main/samples/expo
and the Web Release build is working with the fix. (Debug is not
affected, as premodules are changed only for release.)

# Checklist

<!--
Please check the appropriate items below if they apply to your diff.
This is required for changes to Expo modules.
-->

- [x] Documentation is up to date to reflect these changes (eg:
https://docs.expo.dev and README.md).
- [x] Conforms with the [Documentation Writing Style
Guide](https://github.com/expo/expo/blob/main/guides/Expo%20Documentation%20Writing%20Style%20Guide.md)
- [x] This diff will work correctly for `npx expo prebuild` & EAS Build
(eg: updated a module plugin).
  • Loading branch information
krystofwoldrich authored and entiendoNull committed Dec 13, 2024
1 parent 6904873 commit dd6e1a8
Show file tree
Hide file tree
Showing 6 changed files with 193 additions and 31 deletions.
2 changes: 2 additions & 0 deletions packages/@expo/metro-config/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@

### 🐛 Bug fixes

- Exclude `beforeAssetSerializationPlugins.preModules` from `stableChunkSource` ([#33344](https://github.com/expo/expo/pull/33344) by [@krystofwoldrich](https://github.com/krystofwoldrich))

### 💡 Others

## 0.19.5 - 2024-11-29
Expand Down
28 changes: 17 additions & 11 deletions packages/@expo/metro-config/build/serializer/serializeChunks.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit dd6e1a8

Please sign in to comment.