Skip to content

Commit

Permalink
fix(register): default TSCONFIG_PATH on windows. (#818)
Browse files Browse the repository at this point in the history
  • Loading branch information
simonbuchan authored Jul 15, 2024
1 parent f6735ab commit 92a3bbf
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/register/esm.mts
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand All @@ -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
Expand Down

0 comments on commit 92a3bbf

Please sign in to comment.