Skip to content

Commit b20f3c9

Browse files
ESM: proper version check in hasStableEsmImplementation (#4653)
1 parent 8339c3d commit b20f3c9

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

lib/esm-utils.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,9 @@ const hasStableEsmImplementation = (() => {
3434
const [major, minor] = process.version.split('.');
3535
// ESM is stable from v12.22.0 onward
3636
// https://nodejs.org/api/esm.html#esm_modules_ecmascript_modules
37-
return parseInt(major.slice(1), 10) > 12 || parseInt(minor, 10) >= 22;
37+
const majorNumber = parseInt(major.slice(1), 10);
38+
const minorNumber = parseInt(minor, 10);
39+
return majorNumber > 12 || (majorNumber === 12 && minorNumber >= 22);
3840
})();
3941

4042
exports.requireOrImport = hasStableEsmImplementation

0 commit comments

Comments
 (0)