Skip to content

Commit b60a3c2

Browse files
authored
fix(node): Guard against process.argv[1] being undefined (#10155)
Closes #10150
1 parent 4f44046 commit b60a3c2

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

packages/node/src/module.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ function normalizeWindowsPath(path: string): string {
1010

1111
/** Creates a function that gets the module name from a filename */
1212
export function createGetModuleFromFilename(
13-
basePath: string = dirname(process.argv[1]),
13+
basePath: string = process.argv[1] ? dirname(process.argv[1]) : process.cwd(),
1414
isWindows: boolean = sep === '\\',
1515
): (filename: string | undefined) => string | undefined {
1616
const normalizedBase = isWindows ? normalizeWindowsPath(basePath) : basePath;

0 commit comments

Comments
 (0)