Skip to content

fix: handle early JS errors like in Metro#829

Merged
jbroma merged 9 commits intomainfrom
fix/early-js-errors
Dec 18, 2024
Merged

fix: handle early JS errors like in Metro#829
jbroma merged 9 commits intomainfrom
fix/early-js-errors

Conversation

@jbroma
Copy link
Copy Markdown
Contributor

@jbroma jbroma commented Dec 17, 2024

Summary

Closes #621
Closes #794

This PR fixes the problem where early JS errors on iOS would result in a white screen without any meaningful information. Early JS errors are now visible on both platforms inside a LogBox window (parity with Metro).

For now caching of module errors is disabled (as we disable strictErrorModuleHandling in the Target Plugin) and we should handle this in the interceptor as well in the future.

Separate PR should address formatting of the errors to match the presets here (or we could override the whole module and parse LogBoxLog ourselves)

Screenshots

Syntax error showing up in LogBox (although not being parsed correctly, see reason above):

before after
image image

Early JS errors visible on iOS

before after
image image

Test plan

  • - testers show early JS errors

@changeset-bot
Copy link
Copy Markdown

changeset-bot bot commented Dec 17, 2024

🦋 Changeset detected

Latest commit: 93a4668

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 4 packages
Name Type
@callstack/repack Patch
@callstack/repack-plugin-reanimated Patch
@callstack/repack-dev-server Patch
@callstack/repack-init Patch

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

@vercel
Copy link
Copy Markdown

vercel bot commented Dec 17, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

1 Skipped Deployment
Name Status Preview Comments Updated (UTC)
repack-website ⬜️ Ignored (Inspect) Visit Preview Dec 18, 2024 2:50pm

@jbroma jbroma marked this pull request as ready for review December 18, 2024 12:55
Comment thread packages/repack/src/plugins/RepackTargetPlugin/implementation/init.ts Outdated
@jbroma
Copy link
Copy Markdown
Contributor Author

jbroma commented Dec 18, 2024

added some extra error handling for a rare scenario where there might be no ErrorUtils defined in the global scope 👍

@jbroma
Copy link
Copy Markdown
Contributor Author

jbroma commented Dec 18, 2024

thank you for the review @thymikee 🎉

@jbroma jbroma merged commit 617c501 into main Dec 18, 2024
@jbroma jbroma deleted the fix/early-js-errors branch December 18, 2024 14:54
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.

index.js not running when using ModuleFederationPluginV2 How to debug blank screen issue with no error output?

2 participants