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(