From c8d5b9891d75de1f8cdabb258ee0be2d78bcf5db Mon Sep 17 00:00:00 2001 From: Michael Crane Date: Mon, 15 Jun 2020 15:33:51 -0700 Subject: [PATCH] Load ETW module from a specified path --- src/compiler/perfLogger.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/compiler/perfLogger.ts b/src/compiler/perfLogger.ts index 8ed8feac90c4c..f05e8a3bd1053 100644 --- a/src/compiler/perfLogger.ts +++ b/src/compiler/perfLogger.ts @@ -28,9 +28,11 @@ namespace ts { // See https://github.com/microsoft/typescript-etw for more information let etwModule; try { - // require() will throw an exception if the module is not installed + const etwModulePath = process.env.TS_ETW_MODULE_PATH ?? "./node_modules/@microsoft/typescript-etw"; + + // require() will throw an exception if the module is not found // It may also return undefined if not installed properly - etwModule = require("@microsoft/typescript-etw"); + etwModule = require(etwModulePath); } catch (e) { etwModule = undefined;