From 92a3bbf329269a1d123ea4513541d3a6a418dd2d Mon Sep 17 00:00:00 2001 From: Simon Buchan Date: Mon, 15 Jul 2024 16:35:57 +1200 Subject: [PATCH] fix(register): default TSCONFIG_PATH on windows. (#818) --- packages/register/esm.mts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/register/esm.mts b/packages/register/esm.mts index 6f62babc0..ee23664c6 100644 --- a/packages/register/esm.mts +++ b/packages/register/esm.mts @@ -7,7 +7,7 @@ import { type ResolveHook, builtinModules, } from 'node:module' -import { extname, join } from 'node:path' +import { extname, isAbsolute, join } from 'node:path' import { fileURLToPath, parse as parseUrl, pathToFileURL } from 'node:url' import debugFactory from 'debug' @@ -29,7 +29,7 @@ tsconfig.module = ts.ModuleKind.ESNext const TSCONFIG_PATH = (function () { const pathFromEnv = process.env.SWC_NODE_PROJECT ?? process.env.TS_NODE_PROJECT ?? join(process.cwd(), 'tsconfig.json') - if (!pathFromEnv.startsWith('/')) { + if (!isAbsolute(pathFromEnv)) { return join(process.cwd(), pathFromEnv) } return pathFromEnv