We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 25eb720 commit 77c7d97Copy full SHA for 77c7d97
lib/internal/modules/esm/resolve.js
@@ -74,13 +74,8 @@ function getConditionsSet(conditions) {
74
const realpathCache = new SafeMap();
75
const packageJSONCache = new SafeMap(); /* string -> PackageConfig */
76
77
-function tryStatSync(path) {
78
- try {
79
- return statSync(path);
80
- } catch {
81
- return new Stats();
82
- }
83
-}
+const tryStatSync =
+ (path) => statSync(path, { throwIfNoEntry: false }) ?? new Stats();
84
85
function getPackageConfig(path, specifier, base) {
86
const existing = packageJSONCache.get(path);
0 commit comments