Skip to content

Commit

Permalink
fix(metro-resolver-symlinks): include mtime to make hash more unique (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
tido64 committed Apr 9, 2024
1 parent 99ca824 commit 487d867
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/cuddly-readers-burn.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@rnx-kit/metro-resolver-symlinks": patch
---

Ensure hash uniqueness when `experimental_retryResolvingFromDisk` is enabled
8 changes: 7 additions & 1 deletion packages/metro-resolver-symlinks/src/utils/patchMetro.ts
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,13 @@ export function patchMetro(options: Options): void {
// `ReferenceError` will always be thrown when Metro encounters a file
// that does not exist in the Haste map.
if (e instanceof ReferenceError) {
return filePath;
// Paths generated by pnpm setups include version numbers and/or hashes
if (filePath.includes(".pnpm-store") || filePath.includes(".store")) {
return filePath;
}

const stat = fs.lstatSync(filePath);
return filePath + "|" + stat.mtime.toISOString();
}

throw e;
Expand Down

0 comments on commit 487d867

Please sign in to comment.