You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Today, I used patch-package to patch metro@0.80.6 for the project I'm working on.
While working, I noticed an issue with asset file path error handling in metro. The error message was not formatting the file path correctly, making debugging more difficult. To resolve this, I applied a small patch that corrects the template literal syntax for error messages.
Here is the diff that solved my problem:
diff --git a/node_modules/metro/src/node-haste/lib/AssetPaths.js b/node_modules/metro/src/node-haste/lib/AssetPaths.js
index 7d44292..4a2577a 100644
--- a/node_modules/metro/src/node-haste/lib/AssetPaths.js+++ b/node_modules/metro/src/node-haste/lib/AssetPaths.js@@ -41,7 +41,7 @@ function tryParse(filePath, platforms) {
function parse(filePath, platforms) {
const result = tryParse(filePath, platforms);
if (result == null) {
- throw new Error("invalid asset file path: `${filePath}");+ throw new Error(`invalid asset file path: ${filePath}`);
}
return result;
}
This change ensures that the error message correctly includes the file path, aiding in troubleshooting and enhancing the developer experience. I believe this might be beneficial for others facing similar issues.
The text was updated successfully, but these errors were encountered:
…1267)
Summary:
This is a PR that solves [issue 1265](#1265).
This pull request corrects a syntax error in the template literal used for handling error messages regarding asset file paths within Metro. The existing implementation failed to properly format the file path in the error message. This change updates the syntax to correctly embed the file path variable into the error message.
Changelog: [Fix] Correct template literal syntax in error handling for asset file paths.
Pull Request resolved: #1267
Test Plan:
To verify the correction, I conducted the following steps:
1. Triggered the error handling code with an incorrect asset file path to ensure the error message **includes the intended file path**.
2. Reviewed the output to confirm the file path is now **correctly formatted** within the error message.
Reviewed By: huntie
Differential Revision: D56811594
Pulled By: robhogan
fbshipit-source-id: f089996659222bca3cd0896ae13292ebb4747428
Hi! 👋
Today, I used patch-package to patch
metro@0.80.6
for the project I'm working on.While working, I noticed an issue with asset file path error handling in
metro
. The error message was not formatting the file path correctly, making debugging more difficult. To resolve this, I applied a small patch that corrects the template literal syntax for error messages.Here is the diff that solved my problem:
This change ensures that the error message correctly includes the file path, aiding in troubleshooting and enhancing the developer experience. I believe this might be beneficial for others facing similar issues.
The text was updated successfully, but these errors were encountered: