Skip to content

Commit 97c3a47

Browse files
authored
fix(metro-resolver-symlinks): fix experimental_retryResolvingFromDisk on metro 0.81 (#3641)
1 parent 13c5323 commit 97c3a47

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

.changeset/hot-tomatoes-draw.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@rnx-kit/metro-resolver-symlinks": patch
3+
---
4+
5+
Fix experimental_retryResolvingFromDisk on metro 0.81

packages/metro-resolver-symlinks/src/utils/metro.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,12 @@ export function patchMetro(options: Options): void {
165165
} catch (e) {
166166
// `ReferenceError` will always be thrown when Metro encounters a file
167167
// that does not exist in the Haste map.
168-
if (e instanceof ReferenceError) {
168+
// In metro 0.81 (https://github.com/facebook/metro/pull/1435)
169+
// this was changed to a standard `Error` - so verify the message
170+
if (
171+
e instanceof ReferenceError ||
172+
(e instanceof Error && e.message.startsWith("Failed to get the SHA-1"))
173+
) {
169174
// Paths generated by pnpm setups include version numbers and/or hashes
170175
if (filePath.includes(".pnpm-store") || filePath.includes(".store")) {
171176
return filePath;

0 commit comments

Comments
 (0)