Skip to content

Commit 0baab20

Browse files
committed
tweak logic to use our reusable version number comparison function
1 parent 7beb4c3 commit 0baab20

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

src/bin.ts

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import {
1717
STDIN_NAME,
1818
REPL_FILENAME,
1919
} from './repl';
20-
import { VERSION, TSError, register } from './index';
20+
import { VERSION, TSError, register, versionGteLt } from './index';
2121
import type { TSInternal } from './ts-compiler-types';
2222
import { addBuiltinLibsToObject } from '../dist-raw/node-cjs-helpers';
2323

@@ -431,10 +431,7 @@ function requireResolveNonCached(absoluteModuleSpecifier: string) {
431431
// On those node versions, pollute the require cache instead. This is a deliberate
432432
// ts-node limitation that will *rarely* manifest, and will not matter once node 12
433433
// is end-of-life'd on 2022-04-30
434-
const [major, minor] = process.versions.node
435-
.split('.')
436-
.map((v) => parseInt(v, 10));
437-
const isSupportedNodeVersion = major >= 13 || (major == 12 && minor > 1);
434+
const isSupportedNodeVersion = versionGteLt(process.versions.node, '12.2.0');
438435
if (!isSupportedNodeVersion) return require.resolve(absoluteModuleSpecifier);
439436

440437
const { dir, base } = parsePath(absoluteModuleSpecifier);

0 commit comments

Comments
 (0)