Skip to content

Commit 9920da2

Browse files
Ortaandrewbranch
Orta
authored andcommitted
Ensure that TS can run in a browser by checking for a process obj before using it in the perf logger (#33141)
1 parent 8ca36f3 commit 9920da2

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/compiler/perfLogger.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,6 @@ namespace ts {
3838

3939
/** Performance logger that will generate ETW events if possible - check for `logEvent` member, as `etwModule` will be `{}` when browserified */
4040
export const perfLogger: PerfLogger = etwModule && etwModule.logEvent ? etwModule : nullLogger;
41-
42-
perfLogger.logInfoEvent(`Starting TypeScript v${versionMajorMinor} with command line: ${JSON.stringify(process.argv)}`);
41+
const args = typeof process === "undefined" ? [] : process.argv;
42+
perfLogger.logInfoEvent(`Starting TypeScript v${versionMajorMinor} with command line: ${JSON.stringify(args)}`);
4343
}

0 commit comments

Comments
 (0)