From f4cae01e277a5519e633efce5d35b52612cd1baf Mon Sep 17 00:00:00 2001 From: krigga Date: Mon, 1 May 2023 20:55:17 +0300 Subject: [PATCH] Add installSourceMapSupport configuration option --- src/configuration.ts | 2 ++ src/index.ts | 6 +++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/configuration.ts b/src/configuration.ts index c59536986..1f3e1de0e 100644 --- a/src/configuration.ts +++ b/src/configuration.ts @@ -406,6 +406,7 @@ function filterRecognizedTsConfigTsNodeOptions(jsonObject: any): { esm, experimentalSpecifierResolution, experimentalTsImportSpecifiers, + installSourceMapSupport, ...unrecognized } = jsonObject as TsConfigOptions; const filteredTsConfigOptions = { @@ -433,6 +434,7 @@ function filterRecognizedTsConfigTsNodeOptions(jsonObject: any): { esm, experimentalSpecifierResolution, experimentalTsImportSpecifiers, + installSourceMapSupport, }; // Use the typechecker to make sure this implementation has the correct set of properties const catchExtraneousProps: keyof TsConfigOptions = diff --git a/src/index.ts b/src/index.ts index 58a47cc9e..d9decce03 100644 --- a/src/index.ts +++ b/src/index.ts @@ -389,6 +389,8 @@ export interface RegisterOptions extends CreateOptions { * For details, see https://github.com/TypeStrong/ts-node/issues/1514 */ experimentalResolver?: boolean; + + installSourceMapSupport?: boolean; } export type ExperimentalSpecifierResolution = 'node' | 'explicit'; @@ -582,7 +584,9 @@ export function register( installCommonjsResolveHooksIfNecessary(service); - service.installSourceMapSupport(); + if (service.options.installSourceMapSupport ?? true) { + service.installSourceMapSupport(); + } // Require specified modules before start-up. (Module as ModuleConstructorWithInternals)._preloadModules(