We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 5693ed9 commit 543ecbdCopy full SHA for 543ecbd
lib/internal/modules/esm/resolve.js
@@ -104,13 +104,8 @@ function getConditionsSet(conditions) {
104
const realpathCache = new SafeMap();
105
const packageJSONCache = new SafeMap(); /* string -> PackageConfig */
106
107
-function tryStatSync(path) {
108
- try {
109
- return statSync(path);
110
- } catch {
111
- return new Stats();
112
- }
113
-}
+const tryStatSync =
+ (path) => statSync(path, { throwIfNoEntry: false }) ?? new Stats();
114
115
function getPackageConfig(path, specifier, base) {
116
const existing = packageJSONCache.get(path);
0 commit comments