Cherry-pick PR #39599 into release-3.9 (#39601)

Component commits:
c8d5b9891d Load ETW module from a specified path

Co-authored-by: Michael Crane <micran@microsoft.com>
This commit is contained in:
TypeScript Bot 2020-07-14 14:44:53 -04:00 committed by GitHub
parent 75d6648f89
commit 761a9ed6db
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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;