diff --git a/src/compiler/builder.ts b/src/compiler/builder.ts
index 2b578cecfc035..aec8cae3cea12 100644
--- a/src/compiler/builder.ts
+++ b/src/compiler/builder.ts
@@ -258,6 +258,14 @@ namespace ts {
             Debug.assert(!state.seenAffectedFiles || !state.seenAffectedFiles.size);
             state.seenAffectedFiles = state.seenAffectedFiles || new Set();
         }
+        if (useOldState) {
+            // Any time the interpretation of a source file changes, mark it as changed
+            forEachEntry(oldState!.fileInfos, (info, sourceFilePath) => {
+                if (state.fileInfos.has(sourceFilePath) && state.fileInfos.get(sourceFilePath)!.impliedFormat !== info.impliedFormat) {
+                    state.changedFilesSet.add(sourceFilePath);
+                }
+            });
+        }
 
         state.buildInfoEmitPending = !!state.changedFilesSet.size;
         return state;
@@ -744,13 +752,13 @@ namespace ts {
             const actualSignature = signature ?? value.signature;
             return value.version === actualSignature ?
                 value.affectsGlobalScope ?
-                    { version: value.version, signature: undefined, affectsGlobalScope: true } :
+                    { version: value.version, signature: undefined, affectsGlobalScope: true, impliedFormat: value.impliedFormat } :
                     value.version :
                 actualSignature !== undefined ?
                     signature === undefined ?
                         value :
-                        { version: value.version, signature, affectsGlobalScope: value.affectsGlobalScope } :
-                    { version: value.version, signature: false, affectsGlobalScope: value.affectsGlobalScope };
+                        { version: value.version, signature, affectsGlobalScope: value.affectsGlobalScope, impliedFormat: value.impliedFormat } :
+                    { version: value.version, signature: false, affectsGlobalScope: value.affectsGlobalScope, impliedFormat: value.impliedFormat };
         });
 
         let referencedMap: ProgramBuildInfoReferencedMap | undefined;
@@ -1243,10 +1251,10 @@ namespace ts {
 
     export function toBuilderStateFileInfo(fileInfo: ProgramBuildInfoFileInfo): BuilderState.FileInfo {
         return isString(fileInfo) ?
-            { version: fileInfo, signature: fileInfo, affectsGlobalScope: undefined } :
+            { version: fileInfo, signature: fileInfo, affectsGlobalScope: undefined, impliedFormat: undefined } :
             isString(fileInfo.signature) ?
                 fileInfo as BuilderState.FileInfo :
-                { version: fileInfo.version, signature: fileInfo.signature === false ? undefined : fileInfo.version, affectsGlobalScope: fileInfo.affectsGlobalScope };
+                { version: fileInfo.version, signature: fileInfo.signature === false ? undefined : fileInfo.version, affectsGlobalScope: fileInfo.affectsGlobalScope, impliedFormat: fileInfo.impliedFormat };
     }
 
     export function createBuildProgramUsingProgramBuildInfo(program: ProgramBuildInfo, buildInfoPath: string, host: ReadBuildProgramHost): EmitAndSemanticDiagnosticsBuilderProgram {
diff --git a/src/compiler/builderState.ts b/src/compiler/builderState.ts
index 6578962ebf0c8..a64a6c13ed1e8 100644
--- a/src/compiler/builderState.ts
+++ b/src/compiler/builderState.ts
@@ -82,6 +82,7 @@ namespace ts {
             readonly version: string;
             signature: string | undefined;
             affectsGlobalScope: boolean | undefined;
+            impliedFormat: number | undefined;
         }
 
         export interface ReadonlyManyToManyPathMap {
@@ -332,7 +333,7 @@ namespace ts {
                         }
                     }
                 }
-                fileInfos.set(sourceFile.resolvedPath, { version, signature: oldInfo && oldInfo.signature, affectsGlobalScope: isFileAffectingGlobalScope(sourceFile) || undefined });
+                fileInfos.set(sourceFile.resolvedPath, { version, signature: oldInfo && oldInfo.signature, affectsGlobalScope: isFileAffectingGlobalScope(sourceFile) || undefined, impliedFormat: sourceFile.impliedNodeFormat });
             }
 
             return {
@@ -433,7 +434,7 @@ namespace ts {
                 );
                 const firstDts = firstOrUndefined(emitOutput.outputFiles);
                 if (firstDts) {
-                    Debug.assert(fileExtensionIs(firstDts.name, Extension.Dts), "File extension for signature expected to be dts", () => `Found: ${getAnyExtensionFromPath(firstDts.name)} for ${firstDts.name}:: All output files: ${JSON.stringify(emitOutput.outputFiles.map(f => f.name))}`);
+                    Debug.assert(fileExtensionIsOneOf(firstDts.name, [Extension.Dts, Extension.Dmts, Extension.Dcts]), "File extension for signature expected to be dts", () => `Found: ${getAnyExtensionFromPath(firstDts.name)} for ${firstDts.name}:: All output files: ${JSON.stringify(emitOutput.outputFiles.map(f => f.name))}`);
                     latestSignature = (computeHash || generateDjb2Hash)(firstDts.text);
                     if (exportedModulesMapCache && latestSignature !== prevSignature) {
                         updateExportedModules(sourceFile, emitOutput.exportedModulesFromDeclarationEmit, exportedModulesMapCache);
diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts
index 3c97166436a20..1f363efa67a48 100644
--- a/src/compiler/checker.ts
+++ b/src/compiler/checker.ts
@@ -30745,6 +30745,12 @@ namespace ts {
         }
 
         function checkAssertion(node: AssertionExpression) {
+            if (node.kind === SyntaxKind.TypeAssertionExpression) {
+                const file = getSourceFileOfNode(node);
+                if (file && fileExtensionIsOneOf(file.fileName, [Extension.Cts, Extension.Mts])) {
+                    grammarErrorOnNode(node, Diagnostics.This_syntax_is_reserved_in_files_with_the_mts_or_cts_extension_Use_an_as_expression_instead);
+                }
+            }
             return checkAssertionWorker(node, node.type, node.expression);
         }
 
@@ -42141,6 +42147,12 @@ namespace ts {
                 return false;
             }
 
+            if (node.typeParameters && !(length(node.typeParameters) > 1 || node.typeParameters.hasTrailingComma || node.typeParameters[0].constraint)) {
+                if (file && fileExtensionIsOneOf(file.fileName, [Extension.Mts, Extension.Cts])) {
+                    grammarErrorOnNode(node.typeParameters[0], Diagnostics.This_syntax_is_reserved_in_files_with_the_mts_or_cts_extension_Add_a_trailing_comma_or_explicit_constraint);
+                }
+            }
+
             const { equalsGreaterThanToken } = node;
             const startLine = getLineAndCharacterOfPosition(file, equalsGreaterThanToken.pos).line;
             const endLine = getLineAndCharacterOfPosition(file, equalsGreaterThanToken.end).line;
diff --git a/src/compiler/commandLineParser.ts b/src/compiler/commandLineParser.ts
index df86b9b1a92ea..db4a7563eca0c 100644
--- a/src/compiler/commandLineParser.ts
+++ b/src/compiler/commandLineParser.ts
@@ -3218,7 +3218,7 @@ namespace ts {
         // Rather than re-query this for each file and filespec, we query the supported extensions
         // once and store it on the expansion context.
         const supportedExtensions = getSupportedExtensions(options, extraFileExtensions);
-        const supportedExtensionsWithJsonIfResolveJsonModule = getSuppoertedExtensionsWithJsonIfResolveJsonModule(options, supportedExtensions);
+        const supportedExtensionsWithJsonIfResolveJsonModule = getSupportedExtensionsWithJsonIfResolveJsonModule(options, supportedExtensions);
 
         // Literal files are always included verbatim. An "include" or "exclude" specification cannot
         // remove a literal file.
@@ -3231,7 +3231,7 @@ namespace ts {
 
         let jsonOnlyIncludeRegexes: readonly RegExp[] | undefined;
         if (validatedIncludeSpecs && validatedIncludeSpecs.length > 0) {
-            for (const file of host.readDirectory(basePath, supportedExtensionsWithJsonIfResolveJsonModule, validatedExcludeSpecs, validatedIncludeSpecs, /*depth*/ undefined)) {
+            for (const file of host.readDirectory(basePath, flatten(supportedExtensionsWithJsonIfResolveJsonModule), validatedExcludeSpecs, validatedIncludeSpecs, /*depth*/ undefined)) {
                 if (fileExtensionIs(file, Extension.Json)) {
                     // Valid only if *.json specified
                     if (!jsonOnlyIncludeRegexes) {
@@ -3456,16 +3456,24 @@ namespace ts {
      * extension priority.
      *
      * @param file The path to the file.
-     * @param extensionPriority The priority of the extension.
-     * @param context The expansion context.
      */
-    function hasFileWithHigherPriorityExtension(file: string, literalFiles: ESMap<string, string>, wildcardFiles: ESMap<string, string>, extensions: readonly string[], keyMapper: (value: string) => string) {
-        const extensionPriority = getExtensionPriority(file, extensions);
-        const adjustedExtensionPriority = adjustExtensionPriority(extensionPriority, extensions);
-        for (let i = ExtensionPriority.Highest; i < adjustedExtensionPriority; i++) {
-            const higherPriorityExtension = extensions[i];
-            const higherPriorityPath = keyMapper(changeExtension(file, higherPriorityExtension));
+    function hasFileWithHigherPriorityExtension(file: string, literalFiles: ESMap<string, string>, wildcardFiles: ESMap<string, string>, extensions: readonly string[][], keyMapper: (value: string) => string) {
+        const extensionGroup = forEach(extensions, group => fileExtensionIsOneOf(file, group) ? group : undefined);
+        if (!extensionGroup) {
+            return false;
+        }
+        for (const ext of extensionGroup) {
+            if (fileExtensionIs(file, ext)) {
+                return false;
+            }
+            const higherPriorityPath = keyMapper(changeExtension(file, ext));
             if (literalFiles.has(higherPriorityPath) || wildcardFiles.has(higherPriorityPath)) {
+                if (ext === Extension.Dts && (fileExtensionIs(file, Extension.Js) || fileExtensionIs(file, Extension.Jsx))) {
+                    // LEGACY BEHAVIOR: An off-by-one bug somewhere in the extension priority system for wildcard module loading allowed declaration
+                    // files to be loaded alongside their js(x) counterparts. We regard this as generally undesirable, but retain the behavior to
+                    // prevent breakage.
+                    continue;
+                }
                 return true;
             }
         }
@@ -3478,15 +3486,18 @@ namespace ts {
      * already been included.
      *
      * @param file The path to the file.
-     * @param extensionPriority The priority of the extension.
-     * @param context The expansion context.
      */
-    function removeWildcardFilesWithLowerPriorityExtension(file: string, wildcardFiles: ESMap<string, string>, extensions: readonly string[], keyMapper: (value: string) => string) {
-        const extensionPriority = getExtensionPriority(file, extensions);
-        const nextExtensionPriority = getNextLowestExtensionPriority(extensionPriority, extensions);
-        for (let i = nextExtensionPriority; i < extensions.length; i++) {
-            const lowerPriorityExtension = extensions[i];
-            const lowerPriorityPath = keyMapper(changeExtension(file, lowerPriorityExtension));
+    function removeWildcardFilesWithLowerPriorityExtension(file: string, wildcardFiles: ESMap<string, string>, extensions: readonly string[][], keyMapper: (value: string) => string) {
+        const extensionGroup = forEach(extensions, group => fileExtensionIsOneOf(file, group) ? group : undefined);
+        if (!extensionGroup) {
+            return;
+        }
+        for (let i = extensionGroup.length - 1; i >= 0; i--) {
+            const ext = extensionGroup[i];
+            if (fileExtensionIs(file, ext)) {
+                return;
+            }
+            const lowerPriorityPath = keyMapper(changeExtension(file, ext));
             wildcardFiles.delete(lowerPriorityPath);
         }
     }
diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json
index b07761d1bf275..714b09081c4a1 100644
--- a/src/compiler/diagnosticMessages.json
+++ b/src/compiler/diagnosticMessages.json
@@ -5940,6 +5940,14 @@
         "category": "Error",
         "code": 7058
     },
+    "This syntax is reserved in files with the .mts or .cts extension. Use an `as` expression instead.": {
+        "category": "Error",
+        "code": 7059
+    },
+    "This syntax is reserved in files with the .mts or .cts extension. Add a trailing comma or explicit constraint.": {
+        "category": "Error",
+        "code": 7060
+    },
 
 
     "You cannot rename this element.": {
diff --git a/src/compiler/emitter.ts b/src/compiler/emitter.ts
index 23cdda71a2ac1..795239e13d6ec 100644
--- a/src/compiler/emitter.ts
+++ b/src/compiler/emitter.ts
@@ -89,7 +89,7 @@ namespace ts {
             return getOutputPathsForBundle(options, forceDtsPaths);
         }
         else {
-            const ownOutputFilePath = getOwnEmitOutputFilePath(sourceFile.fileName, host, getOutputExtension(sourceFile, options));
+            const ownOutputFilePath = getOwnEmitOutputFilePath(sourceFile.fileName, host, getOutputExtension(sourceFile.fileName, options));
             const isJsonFile = isJsonSourceFile(sourceFile);
             // If json file emits to the same location skip writing it, if emitDeclarationOnly skip writing it
             const isJsonEmittedToSameLocation = isJsonFile &&
@@ -106,27 +106,13 @@ namespace ts {
         return (options.sourceMap && !options.inlineSourceMap) ? jsFilePath + ".map" : undefined;
     }
 
-    // JavaScript files are always LanguageVariant.JSX, as JSX syntax is allowed in .js files also.
-    // So for JavaScript files, '.jsx' is only emitted if the input was '.jsx', and JsxEmit.Preserve.
-    // For TypeScript, the only time to emit with a '.jsx' extension, is on JSX input, and JsxEmit.Preserve
     /* @internal */
-    export function getOutputExtension(sourceFile: SourceFile, options: CompilerOptions): Extension {
-        if (isJsonSourceFile(sourceFile)) {
-            return Extension.Json;
-        }
-
-        if (options.jsx === JsxEmit.Preserve) {
-            if (isSourceFileJS(sourceFile)) {
-                if (fileExtensionIs(sourceFile.fileName, Extension.Jsx)) {
-                    return Extension.Jsx;
-                }
-            }
-            else if (sourceFile.languageVariant === LanguageVariant.JSX) {
-                // TypeScript source file preserving JSX syntax
-                return Extension.Jsx;
-            }
-        }
-        return Extension.Js;
+    export function getOutputExtension(fileName: string, options: CompilerOptions): Extension {
+        return fileExtensionIs(fileName, Extension.Json) ? Extension.Json :
+        options.jsx === JsxEmit.Preserve && fileExtensionIsOneOf(fileName, [Extension.Jsx, Extension.Tsx]) ? Extension.Jsx :
+        fileExtensionIsOneOf(fileName, [Extension.Mts, Extension.Mjs]) ? Extension.Mjs :
+        fileExtensionIsOneOf(fileName, [Extension.Cts, Extension.Cjs]) ? Extension.Cjs :
+        Extension.Js;
     }
 
     function getOutputPathWithoutChangingExt(inputFileName: string, configFile: ParsedCommandLine, ignoreCase: boolean, outputDir: string | undefined, getCommonSourceDirectory?: () => string) {
@@ -140,10 +126,9 @@ namespace ts {
 
     /* @internal */
     export function getOutputDeclarationFileName(inputFileName: string, configFile: ParsedCommandLine, ignoreCase: boolean, getCommonSourceDirectory?: () => string) {
-        Debug.assert(!fileExtensionIs(inputFileName, Extension.Dts) && !fileExtensionIs(inputFileName, Extension.Json));
         return changeExtension(
             getOutputPathWithoutChangingExt(inputFileName, configFile, ignoreCase, configFile.options.declarationDir || configFile.options.outDir, getCommonSourceDirectory),
-            Extension.Dts
+            getDeclarationEmitExtensionForPath(inputFileName)
         );
     }
 
@@ -152,11 +137,7 @@ namespace ts {
         const isJsonFile = fileExtensionIs(inputFileName, Extension.Json);
         const outputFileName = changeExtension(
             getOutputPathWithoutChangingExt(inputFileName, configFile, ignoreCase, configFile.options.outDir, getCommonSourceDirectory),
-            isJsonFile ?
-                Extension.Json :
-                configFile.options.jsx === JsxEmit.Preserve && (fileExtensionIs(inputFileName, Extension.Tsx) || fileExtensionIs(inputFileName, Extension.Jsx)) ?
-                    Extension.Jsx :
-                    Extension.Js
+            getOutputExtension(inputFileName, configFile.options)
         );
         return !isJsonFile || comparePaths(inputFileName, outputFileName, Debug.checkDefined(configFile.options.configFilePath), ignoreCase) !== Comparison.EqualTo ?
             outputFileName :
@@ -238,7 +219,7 @@ namespace ts {
     export function getCommonSourceDirectoryOfConfig({ options, fileNames }: ParsedCommandLine, ignoreCase: boolean): string {
         return getCommonSourceDirectory(
             options,
-            () => filter(fileNames, file => !(options.noEmitForJsFiles && fileExtensionIsOneOf(file, supportedJSExtensions)) && !fileExtensionIs(file, Extension.Dts)),
+            () => filter(fileNames, file => !(options.noEmitForJsFiles && fileExtensionIsOneOf(file, supportedJSExtensionsFlat)) && !fileExtensionIs(file, Extension.Dts)),
             getDirectoryPath(normalizeSlashes(Debug.checkDefined(options.configFilePath))),
             createGetCanonicalFileName(!ignoreCase)
         );
diff --git a/src/compiler/moduleNameResolver.ts b/src/compiler/moduleNameResolver.ts
index 2686ccaa9a7d4..af8fdf1e3b40a 100644
--- a/src/compiler/moduleNameResolver.ts
+++ b/src/compiler/moduleNameResolver.ts
@@ -1253,11 +1253,12 @@ namespace ts {
     function loadModuleFromFile(extensions: Extensions, candidate: string, onlyRecordFailures: boolean, state: ModuleResolutionState): PathAndExtension | undefined {
         if (extensions === Extensions.Json || extensions === Extensions.TSConfig) {
             const extensionLess = tryRemoveExtension(candidate, Extension.Json);
-            return (extensionLess === undefined && extensions === Extensions.Json) ? undefined : tryAddingExtensions(extensionLess || candidate, extensions, onlyRecordFailures, state);
+            const extension = extensionLess ? candidate.substring(extensionLess.length) : "";
+            return (extensionLess === undefined && extensions === Extensions.Json) ? undefined : tryAddingExtensions(extensionLess || candidate, extensions, extension, onlyRecordFailures, state);
         }
 
         // First, try adding an extension. An import of "foo" could be matched by a file "foo.ts", or "foo.js" by "foo.js.ts"
-        const resolvedByAddingExtension = tryAddingExtensions(candidate, extensions, onlyRecordFailures, state);
+        const resolvedByAddingExtension = tryAddingExtensions(candidate, extensions, "", onlyRecordFailures, state);
         if (resolvedByAddingExtension) {
             return resolvedByAddingExtension;
         }
@@ -1266,16 +1267,16 @@ namespace ts {
         // e.g. "./foo.js" can be matched by "./foo.ts" or "./foo.d.ts"
         if (hasJSFileExtension(candidate)) {
             const extensionless = removeFileExtension(candidate);
+            const extension = candidate.substring(extensionless.length);
             if (state.traceEnabled) {
-                const extension = candidate.substring(extensionless.length);
                 trace(state.host, Diagnostics.File_name_0_has_a_1_extension_stripping_it, candidate, extension);
             }
-            return tryAddingExtensions(extensionless, extensions, onlyRecordFailures, state);
+            return tryAddingExtensions(extensionless, extensions, extension, onlyRecordFailures, state);
         }
     }
 
     /** Try to return an existing file that adds one of the `extensions` to `candidate`. */
-    function tryAddingExtensions(candidate: string, extensions: Extensions, onlyRecordFailures: boolean, state: ModuleResolutionState): PathAndExtension | undefined {
+    function tryAddingExtensions(candidate: string, extensions: Extensions, originalExtension: string, onlyRecordFailures: boolean, state: ModuleResolutionState): PathAndExtension | undefined {
         if (!onlyRecordFailures) {
             // check if containing folder exists - if it doesn't then just record failures for all supported extensions without disk probing
             const directory = getDirectoryPath(candidate);
@@ -1286,11 +1287,51 @@ namespace ts {
 
         switch (extensions) {
             case Extensions.DtsOnly:
-                return tryExtension(Extension.Dts);
+                switch (originalExtension) {
+                    case Extension.Mjs:
+                    case Extension.Mts:
+                    case Extension.Dmts:
+                        return tryExtension(Extension.Dmts);
+                    case Extension.Cjs:
+                    case Extension.Cts:
+                    case Extension.Dcts:
+                        return tryExtension(Extension.Dcts);
+                    case Extension.Json:
+                        candidate += Extension.Json;
+                        return tryExtension(Extension.Dts);
+                    default: return tryExtension(Extension.Dts);
+                }
             case Extensions.TypeScript:
-                return tryExtension(Extension.Ts) || tryExtension(Extension.Tsx) || tryExtension(Extension.Dts);
+                switch (originalExtension) {
+                    case Extension.Mjs:
+                    case Extension.Mts:
+                    case Extension.Dmts:
+                        return tryExtension(Extension.Mts) || tryExtension(Extension.Dmts);
+                    case Extension.Cjs:
+                    case Extension.Cts:
+                    case Extension.Dcts:
+                        return tryExtension(Extension.Cts) || tryExtension(Extension.Dcts);
+                    case Extension.Json:
+                        candidate += Extension.Json;
+                        return tryExtension(Extension.Dts);
+                    default:
+                        return tryExtension(Extension.Ts) || tryExtension(Extension.Tsx) || tryExtension(Extension.Dts);
+                }
             case Extensions.JavaScript:
-                return tryExtension(Extension.Js) || tryExtension(Extension.Jsx);
+                switch (originalExtension) {
+                    case Extension.Mjs:
+                    case Extension.Mts:
+                    case Extension.Dmts:
+                        return tryExtension(Extension.Mjs);
+                    case Extension.Cjs:
+                    case Extension.Cts:
+                    case Extension.Dcts:
+                        return tryExtension(Extension.Cjs);
+                    case Extension.Json:
+                        return tryExtension(Extension.Json);
+                    default:
+                        return tryExtension(Extension.Js) || tryExtension(Extension.Jsx);
+                }
             case Extensions.TSConfig:
             case Extensions.Json:
                 return tryExtension(Extension.Json);
diff --git a/src/compiler/moduleSpecifiers.ts b/src/compiler/moduleSpecifiers.ts
index de42460d54aeb..8bfffcffb82ef 100644
--- a/src/compiler/moduleSpecifiers.ts
+++ b/src/compiler/moduleSpecifiers.ts
@@ -652,7 +652,7 @@ namespace ts.moduleSpecifiers {
     function tryGetAnyFileFromPath(host: ModuleSpecifierResolutionHost, path: string) {
         if (!host.fileExists) return;
         // We check all js, `node` and `json` extensions in addition to TS, since node module resolution would also choose those over the directory
-        const extensions = getSupportedExtensions({ allowJs: true }, [{ extension: "node", isMixedContent: false }, { extension: "json", isMixedContent: false, scriptKind: ScriptKind.JSON }]);
+        const extensions = flatten(getSupportedExtensions({ allowJs: true }, [{ extension: "node", isMixedContent: false }, { extension: "json", isMixedContent: false, scriptKind: ScriptKind.JSON }]));
         for (const e of extensions) {
             const fullPath = path + e;
             if (host.fileExists(fullPath)) {
diff --git a/src/compiler/program.ts b/src/compiler/program.ts
index e7ea347180232..9733c4cc70783 100644
--- a/src/compiler/program.ts
+++ b/src/compiler/program.ts
@@ -883,7 +883,7 @@ namespace ts {
         const programDiagnostics = createDiagnosticCollection();
         const currentDirectory = host.getCurrentDirectory();
         const supportedExtensions = getSupportedExtensions(options);
-        const supportedExtensionsWithJsonIfResolveJsonModule = getSuppoertedExtensionsWithJsonIfResolveJsonModule(options, supportedExtensions);
+        const supportedExtensionsWithJsonIfResolveJsonModule = getSupportedExtensionsWithJsonIfResolveJsonModule(options, supportedExtensions);
 
         // Map storing if there is emit blocking diagnostics for given input
         const hasEmitBlockingDiagnostics = new Map<string, boolean>();
@@ -903,6 +903,7 @@ namespace ts {
                 withExtension.extension = extensionFromPath(resolved.resolvedFileName);
                 return withExtension;
             });
+            moduleResolutionCache = host.getModuleResolutionCache?.();
         }
         else {
             moduleResolutionCache = createModuleResolutionCache(currentDirectory, getCanonicalFileName, options);
@@ -2472,13 +2473,13 @@ namespace ts {
 
             if (hasExtension(fileName)) {
                 const canonicalFileName = host.getCanonicalFileName(fileName);
-                if (!options.allowNonTsExtensions && !forEach(supportedExtensionsWithJsonIfResolveJsonModule, extension => fileExtensionIs(canonicalFileName, extension))) {
+                if (!options.allowNonTsExtensions && !forEach(flatten(supportedExtensionsWithJsonIfResolveJsonModule), extension => fileExtensionIs(canonicalFileName, extension))) {
                     if (fail) {
                         if (hasJSFileExtension(canonicalFileName)) {
                             fail(Diagnostics.File_0_is_a_JavaScript_file_Did_you_mean_to_enable_the_allowJs_option, fileName);
                         }
                         else {
-                            fail(Diagnostics.File_0_has_an_unsupported_extension_The_only_supported_extensions_are_1, fileName, "'" + supportedExtensions.join("', '") + "'");
+                            fail(Diagnostics.File_0_has_an_unsupported_extension_The_only_supported_extensions_are_1, fileName, "'" + flatten(supportedExtensions).join("', '") + "'");
                         }
                     }
                     return undefined;
@@ -2510,8 +2511,9 @@ namespace ts {
                     return undefined;
                 }
 
-                const sourceFileWithAddedExtension = forEach(supportedExtensions, extension => getSourceFile(fileName + extension));
-                if (fail && !sourceFileWithAddedExtension) fail(Diagnostics.Could_not_resolve_the_path_0_with_the_extensions_Colon_1, fileName, "'" + supportedExtensions.join("', '") + "'");
+                // Only try adding extensions from the first supported group (which should be .ts/.tsx/.d.ts)
+                const sourceFileWithAddedExtension = forEach(supportedExtensions[0], extension => getSourceFile(fileName + extension));
+                if (fail && !sourceFileWithAddedExtension) fail(Diagnostics.Could_not_resolve_the_path_0_with_the_extensions_Colon_1, fileName, "'" + flatten(supportedExtensions).join("', '") + "'");
                 return sourceFileWithAddedExtension;
             }
         }
@@ -3732,7 +3734,7 @@ namespace ts {
                 return containsPath(options.outDir, filePath, currentDirectory, !host.useCaseSensitiveFileNames());
             }
 
-            if (fileExtensionIsOneOf(filePath, supportedJSExtensions) || fileExtensionIs(filePath, Extension.Dts)) {
+            if (fileExtensionIsOneOf(filePath, supportedJSExtensionsFlat) || fileExtensionIs(filePath, Extension.Dts)) {
                 // Otherwise just check if sourceFile with the name exists
                 const filePathWithoutExtension = removeFileExtension(filePath);
                 return !!getSourceFileByPath((filePathWithoutExtension + Extension.Ts) as Path) ||
diff --git a/src/compiler/tsbuildPublic.ts b/src/compiler/tsbuildPublic.ts
index b92741a3de8dc..e8c0b689c62f1 100644
--- a/src/compiler/tsbuildPublic.ts
+++ b/src/compiler/tsbuildPublic.ts
@@ -284,6 +284,7 @@ namespace ts {
             const loader = (moduleName: string, containingFile: string, redirectedReference: ResolvedProjectReference | undefined) => resolveModuleName(moduleName, containingFile, state.projectCompilerOptions, compilerHost, moduleResolutionCache, redirectedReference).resolvedModule!;
             compilerHost.resolveModuleNames = (moduleNames, containingFile, _reusedNames, redirectedReference) =>
                 loadWithLocalCache<ResolvedModuleFull>(Debug.checkEachDefined(moduleNames), containingFile, redirectedReference, loader);
+            compilerHost.getModuleResolutionCache = () => moduleResolutionCache;
         }
         if (!compilerHost.resolveTypeReferenceDirectives) {
             const loader = (moduleName: string, containingFile: string, redirectedReference: ResolvedProjectReference | undefined) => resolveTypeReferenceDirective(moduleName, containingFile, state.projectCompilerOptions, compilerHost, redirectedReference, state.typeReferenceDirectiveResolutionCache).resolvedTypeReferenceDirective!;
diff --git a/src/compiler/types.ts b/src/compiler/types.ts
index 43b1d8afec402..b5c2d5591b93a 100644
--- a/src/compiler/types.ts
+++ b/src/compiler/types.ts
@@ -6649,6 +6649,10 @@ namespace ts {
          * 'throw new Error("NotImplemented")'
          */
         resolveModuleNames?(moduleNames: string[], containingFile: string, reusedNames: string[] | undefined, redirectedReference: ResolvedProjectReference | undefined, options: CompilerOptions): (ResolvedModule | undefined)[];
+        /**
+         * Returns the module resolution cache used by a provided `resolveModuleNames` implementation so that any non-name module resolution operations (eg, package.json lookup) can reuse it
+         */
+        getModuleResolutionCache?(): ModuleResolutionCache | undefined;
         /**
          * This method is a companion for 'resolveModuleNames' and is used to resolve 'types' references to actual type declaration files
          */
diff --git a/src/compiler/utilities.ts b/src/compiler/utilities.ts
index 1bd952203bdc4..55edfc2552acc 100644
--- a/src/compiler/utilities.ts
+++ b/src/compiler/utilities.ts
@@ -4274,7 +4274,15 @@ namespace ts {
         const path = outputDir
             ? getSourceFilePathInNewDirWorker(fileName, outputDir, currentDirectory, commonSourceDirectory, getCanonicalFileName)
             : fileName;
-        return removeFileExtension(path) + Extension.Dts;
+        const declarationExtension = getDeclarationEmitExtensionForPath(path);
+        return removeFileExtension(path) + declarationExtension;
+    }
+
+    export function getDeclarationEmitExtensionForPath(path: string) {
+        return fileExtensionIsOneOf(path, [Extension.Mjs, Extension.Mts]) ? Extension.Dmts :
+            fileExtensionIsOneOf(path, [Extension.Cjs, Extension.Cts]) ? Extension.Dcts :
+            fileExtensionIsOneOf(path, [Extension.Json]) ? `.json.d.ts` : // Drive-by redefinition of json declaration file output name so if it's ever enabled, it behaves well
+            Extension.Dts;
     }
 
     export function outFile(options: CompilerOptions) {
@@ -6742,39 +6750,44 @@ namespace ts {
     }
 
     /**
-     *  List of supported extensions in order of file resolution precedence.
+     *  Groups of supported extensions in order of file resolution precedence. (eg, TS > TSX > DTS and seperately, CTS > DCTS)
      */
-    export const supportedTSExtensions: readonly Extension[] = [Extension.Ts, Extension.Tsx, Extension.Dts];
-    export const supportedTSExtensionsWithJson: readonly Extension[] = [Extension.Ts, Extension.Tsx, Extension.Dts, Extension.Json];
+    export const supportedTSExtensions: readonly Extension[][] = [[Extension.Ts, Extension.Tsx, Extension.Dts], [Extension.Cts, Extension.Dcts], [Extension.Mts, Extension.Dmts]];
+    export const supportedTSExtensionsFlat: readonly Extension[] = flatten(supportedTSExtensions);
+    const supportedTSExtensionsWithJson: readonly Extension[][] = [...supportedTSExtensions, [Extension.Json]];
     /** Must have ".d.ts" first because if ".ts" goes first, that will be detected as the extension instead of ".d.ts". */
-    export const supportedTSExtensionsForExtractExtension: readonly Extension[] = [Extension.Dts, Extension.Ts, Extension.Tsx];
-    export const supportedJSExtensions: readonly Extension[] = [Extension.Js, Extension.Jsx];
-    export const supportedJSAndJsonExtensions: readonly Extension[] = [Extension.Js, Extension.Jsx, Extension.Json];
-    const allSupportedExtensions: readonly Extension[] = [...supportedTSExtensions, ...supportedJSExtensions];
-    const allSupportedExtensionsWithJson: readonly Extension[] = [...supportedTSExtensions, ...supportedJSExtensions, Extension.Json];
-
-    export function getSupportedExtensions(options?: CompilerOptions): readonly Extension[];
-    export function getSupportedExtensions(options?: CompilerOptions, extraFileExtensions?: readonly FileExtensionInfo[]): readonly string[];
-    export function getSupportedExtensions(options?: CompilerOptions, extraFileExtensions?: readonly FileExtensionInfo[]): readonly string[] {
+    const supportedTSExtensionsForExtractExtension: readonly Extension[] = [Extension.Dts, Extension.Dcts, Extension.Dmts, Extension.Cts, Extension.Mts, Extension.Ts, Extension.Tsx, Extension.Cts, Extension.Mts];
+    export const supportedJSExtensions: readonly Extension[][] = [[Extension.Js, Extension.Jsx], [Extension.Mjs], [Extension.Cjs]];
+    export const supportedJSExtensionsFlat: readonly Extension[] = flatten(supportedJSExtensions);
+    const allSupportedExtensions: readonly Extension[][] = [[Extension.Ts, Extension.Tsx, Extension.Dts, Extension.Js, Extension.Jsx], [Extension.Cts, Extension.Dcts, Extension.Cjs], [Extension.Mts, Extension.Dmts, Extension.Mjs]];
+    const allSupportedExtensionsWithJson: readonly Extension[][] = [...allSupportedExtensions, [Extension.Json]];
+
+    export function getSupportedExtensions(options?: CompilerOptions): readonly Extension[][];
+    export function getSupportedExtensions(options?: CompilerOptions, extraFileExtensions?: readonly FileExtensionInfo[]): readonly string[][];
+    export function getSupportedExtensions(options?: CompilerOptions, extraFileExtensions?: readonly FileExtensionInfo[]): readonly string[][] {
         const needJsExtensions = options && getAllowJSCompilerOption(options);
 
         if (!extraFileExtensions || extraFileExtensions.length === 0) {
             return needJsExtensions ? allSupportedExtensions : supportedTSExtensions;
         }
 
+        const builtins = needJsExtensions ? allSupportedExtensions : supportedTSExtensions;
+        const flatBuiltins = flatten(builtins);
         const extensions = [
-            ...needJsExtensions ? allSupportedExtensions : supportedTSExtensions,
-            ...mapDefined(extraFileExtensions, x => x.scriptKind === ScriptKind.Deferred || needJsExtensions && isJSLike(x.scriptKind) ? x.extension : undefined)
+            ...builtins,
+            ...mapDefined(extraFileExtensions, x => x.scriptKind === ScriptKind.Deferred || needJsExtensions && isJSLike(x.scriptKind) && flatBuiltins.indexOf(x.extension as Extension) === -1 ? [x.extension] : undefined)
         ];
 
-        return deduplicate<string>(extensions, equateStringsCaseSensitive, compareStringsCaseSensitive);
+        return extensions;
     }
 
-    export function getSuppoertedExtensionsWithJsonIfResolveJsonModule(options: CompilerOptions | undefined, supportedExtensions: readonly string[]): readonly string[] {
+    export function getSupportedExtensionsWithJsonIfResolveJsonModule(options: CompilerOptions | undefined, supportedExtensions: readonly Extension[][]): readonly Extension[][];
+    export function getSupportedExtensionsWithJsonIfResolveJsonModule(options: CompilerOptions | undefined, supportedExtensions: readonly string[][]): readonly string[][];
+    export function getSupportedExtensionsWithJsonIfResolveJsonModule(options: CompilerOptions | undefined, supportedExtensions: readonly string[][]): readonly string[][] {
         if (!options || !options.resolveJsonModule) return supportedExtensions;
         if (supportedExtensions === allSupportedExtensions) return allSupportedExtensionsWithJson;
         if (supportedExtensions === supportedTSExtensions) return supportedTSExtensionsWithJson;
-        return [...supportedExtensions, Extension.Json];
+        return [...supportedExtensions, [Extension.Json]];
     }
 
     function isJSLike(scriptKind: ScriptKind | undefined): boolean {
@@ -6782,18 +6795,18 @@ namespace ts {
     }
 
     export function hasJSFileExtension(fileName: string): boolean {
-        return some(supportedJSExtensions, extension => fileExtensionIs(fileName, extension));
+        return some(supportedJSExtensionsFlat, extension => fileExtensionIs(fileName, extension));
     }
 
     export function hasTSFileExtension(fileName: string): boolean {
-        return some(supportedTSExtensions, extension => fileExtensionIs(fileName, extension));
+        return some(supportedTSExtensionsFlat, extension => fileExtensionIs(fileName, extension));
     }
 
     export function isSupportedSourceFileName(fileName: string, compilerOptions?: CompilerOptions, extraFileExtensions?: readonly FileExtensionInfo[]) {
         if (!fileName) return false;
 
         const supportedExtensions = getSupportedExtensions(compilerOptions, extraFileExtensions);
-        for (const extension of getSuppoertedExtensionsWithJsonIfResolveJsonModule(compilerOptions, supportedExtensions)) {
+        for (const extension of flatten(getSupportedExtensionsWithJsonIfResolveJsonModule(compilerOptions, supportedExtensions))) {
             if (fileExtensionIs(fileName, extension)) {
                 return true;
             }
@@ -6813,59 +6826,7 @@ namespace ts {
         );
     }
 
-    /**
-     * Extension boundaries by priority. Lower numbers indicate higher priorities, and are
-     * aligned to the offset of the highest priority extension in the
-     * allSupportedExtensions array.
-     */
-    export const enum ExtensionPriority {
-        TypeScriptFiles = 0,
-        DeclarationAndJavaScriptFiles = 2,
-
-        Highest = TypeScriptFiles,
-        Lowest = DeclarationAndJavaScriptFiles,
-    }
-
-    export function getExtensionPriority(path: string, supportedExtensions: readonly string[]): ExtensionPriority {
-        for (let i = supportedExtensions.length - 1; i >= 0; i--) {
-            if (fileExtensionIs(path, supportedExtensions[i])) {
-                return adjustExtensionPriority(i as ExtensionPriority, supportedExtensions);
-            }
-        }
-
-        // If its not in the list of supported extensions, this is likely a
-        // TypeScript file with a non-ts extension
-        return ExtensionPriority.Highest;
-    }
-
-    /**
-     * Adjusts an extension priority to be the highest priority within the same range.
-     */
-    export function adjustExtensionPriority(extensionPriority: ExtensionPriority, supportedExtensions: readonly string[]): ExtensionPriority {
-        if (extensionPriority < ExtensionPriority.DeclarationAndJavaScriptFiles) {
-            return ExtensionPriority.TypeScriptFiles;
-        }
-        else if (extensionPriority < supportedExtensions.length) {
-            return ExtensionPriority.DeclarationAndJavaScriptFiles;
-        }
-        else {
-            return supportedExtensions.length;
-        }
-    }
-
-    /**
-     * Gets the next lowest extension priority for a given priority.
-     */
-    export function getNextLowestExtensionPriority(extensionPriority: ExtensionPriority, supportedExtensions: readonly string[]): ExtensionPriority {
-        if (extensionPriority < ExtensionPriority.DeclarationAndJavaScriptFiles) {
-            return ExtensionPriority.DeclarationAndJavaScriptFiles;
-        }
-        else {
-            return supportedExtensions.length;
-        }
-    }
-
-    const extensionsToRemove = [Extension.Dts, Extension.Ts, Extension.Js, Extension.Tsx, Extension.Jsx, Extension.Json];
+    const extensionsToRemove = [Extension.Dts, Extension.Dmts, Extension.Dcts, Extension.Mjs, Extension.Mts, Extension.Cjs, Extension.Cts, Extension.Ts, Extension.Js, Extension.Tsx, Extension.Jsx, Extension.Json];
     export function removeFileExtension(path: string): string {
         for (const ext of extensionsToRemove) {
             const extensionless = tryRemoveExtension(path, ext);
diff --git a/src/compiler/watchUtilities.ts b/src/compiler/watchUtilities.ts
index aac36908badb2..c6b9df2c3e3b5 100644
--- a/src/compiler/watchUtilities.ts
+++ b/src/compiler/watchUtilities.ts
@@ -499,7 +499,7 @@ namespace ts {
             // If its declaration directory: its not ignored if not excluded by config
             if (options.declarationDir) return false;
         }
-        else if (!fileExtensionIsOneOf(fileOrDirectoryPath, supportedJSExtensions)) {
+        else if (!fileExtensionIsOneOf(fileOrDirectoryPath, supportedJSExtensionsFlat)) {
             return false;
         }
 
diff --git a/src/executeCommandLine/executeCommandLine.ts b/src/executeCommandLine/executeCommandLine.ts
index 87084d4f4bb75..0db32b94c0d9f 100644
--- a/src/executeCommandLine/executeCommandLine.ts
+++ b/src/executeCommandLine/executeCommandLine.ts
@@ -43,10 +43,10 @@ namespace ts {
         }
 
         const path = file.path;
-        if (fileExtensionIsOneOf(path, supportedTSExtensions)) {
+        if (fileExtensionIsOneOf(path, supportedTSExtensionsFlat)) {
             return "TypeScript";
         }
-        else if (fileExtensionIsOneOf(path, supportedJSExtensions)) {
+        else if (fileExtensionIsOneOf(path, supportedJSExtensionsFlat)) {
             return "JavaScript";
         }
         else if (fileExtensionIs(path, Extension.Json)) {
diff --git a/src/harness/compilerImpl.ts b/src/harness/compilerImpl.ts
index 7d42ccea2c0bd..9f7c1503ae8fb 100644
--- a/src/harness/compilerImpl.ts
+++ b/src/harness/compilerImpl.ts
@@ -118,11 +118,11 @@ namespace compiler {
                             const input = new documents.TextDocument(sourceFile.fileName, sourceFile.text);
                             this._inputs.push(input);
                             if (!vpath.isDeclaration(sourceFile.fileName)) {
-                                const extname = ts.getOutputExtension(sourceFile, this.options);
+                                const extname = ts.getOutputExtension(sourceFile.fileName, this.options);
                                 const outputs: CompilationOutput = {
                                     inputs: [input],
                                     js: js.get(this.getOutputPath(sourceFile.fileName, extname)),
-                                    dts: dts.get(this.getOutputPath(sourceFile.fileName, ".d.ts")),
+                                    dts: dts.get(this.getOutputPath(sourceFile.fileName, ts.getDeclarationEmitExtensionForPath(sourceFile.fileName))),
                                     map: maps.get(this.getOutputPath(sourceFile.fileName, extname + ".map"))
                                 };
 
@@ -205,7 +205,7 @@ namespace compiler {
             }
             else {
                 path = vpath.resolve(this.vfs.cwd(), path);
-                const outDir = ext === ".d.ts" ? this.options.declarationDir || this.options.outDir : this.options.outDir;
+                const outDir = ext === ".d.ts" || ext === ".json.d.ts" || ext === ".d.mts" || ext === ".d.cts" ? this.options.declarationDir || this.options.outDir : this.options.outDir;
                 if (outDir) {
                     const common = this.commonSourceDirectory;
                     if (common) {
diff --git a/src/harness/fourslashImpl.ts b/src/harness/fourslashImpl.ts
index 9e4db5e973b1d..7993eb63d3c7c 100644
--- a/src/harness/fourslashImpl.ts
+++ b/src/harness/fourslashImpl.ts
@@ -313,12 +313,13 @@ namespace FourSlash {
                     this.addMatchedInputFile(referenceFilePath, /* extensions */ undefined);
                 });
 
+                const exts = ts.flatten(ts.getSupportedExtensions(compilationOptions));
                 // Add import files into language-service host
                 ts.forEach(importedFiles, importedFile => {
                     // Fourslash insert tests/cases/fourslash into inputFile.unitName and import statement doesn't require ".ts"
                     // so convert them before making appropriate comparison
                     const importedFilePath = this.basePath + "/" + importedFile.fileName;
-                    this.addMatchedInputFile(importedFilePath, ts.getSupportedExtensions(compilationOptions));
+                    this.addMatchedInputFile(importedFilePath, exts);
                 });
 
                 // Check if no-default-lib flag is false and if so add default library
diff --git a/src/harness/vpathUtil.ts b/src/harness/vpathUtil.ts
index 31419e976fffb..44ef5b0f6af3f 100644
--- a/src/harness/vpathUtil.ts
+++ b/src/harness/vpathUtil.ts
@@ -108,7 +108,7 @@ namespace vpath {
     }
 
     export function isDeclaration(path: string) {
-        return extname(path, ".d.ts", /*ignoreCase*/ false).length > 0;
+        return ts.fileExtensionIsOneOf(path, [ts.Extension.Dmts, ts.Extension.Dcts, ts.Extension.Dts]);
     }
 
     export function isSourceMap(path: string) {
diff --git a/src/server/editorServices.ts b/src/server/editorServices.ts
index 81afcd26f79c9..50402fa2c12b3 100644
--- a/src/server/editorServices.ts
+++ b/src/server/editorServices.ts
@@ -4134,7 +4134,7 @@ namespace ts.server {
                     },
                     PollingInterval.Low,
                     this.hostConfiguration.watchOptions,
-                    WatchType.PackageJsonFile,
+                    WatchType.PackageJson,
                 ));
             }
         }
diff --git a/src/server/watchType.ts b/src/server/watchType.ts
index 2b9edafb09870..7893de0e26bc1 100644
--- a/src/server/watchType.ts
+++ b/src/server/watchType.ts
@@ -8,7 +8,6 @@ namespace ts {
         MissingSourceMapFile: "Missing source map file",
         NoopConfigFileForInferredRoot: "Noop Config file for the inferred project root",
         MissingGeneratedFile: "Missing generated file",
-        PackageJsonFile: "package.json file for import suggestions",
         NodeModulesForModuleSpecifierCache: "node_modules for module specifier cache invalidation",
     }
     WatchType.ClosedScriptInfo = "Closed Script info";
@@ -17,5 +16,4 @@ namespace ts {
     WatchType.MissingSourceMapFile = "Missing source map file";
     WatchType.NoopConfigFileForInferredRoot = "Noop Config file for the inferred project root";
     WatchType.MissingGeneratedFile = "Missing generated file";
-    WatchType.PackageJsonFile = "package.json file for import suggestions";
 }
diff --git a/src/services/stringCompletions.ts b/src/services/stringCompletions.ts
index 68356383c4e4d..cc81c6ab97f0e 100644
--- a/src/services/stringCompletions.ts
+++ b/src/services/stringCompletions.ts
@@ -330,7 +330,7 @@ namespace ts.Completions.StringCompletions {
         readonly includeExtensionsOption: IncludeExtensionsOption;
     }
     function getExtensionOptions(compilerOptions: CompilerOptions, includeExtensionsOption = IncludeExtensionsOption.Exclude): ExtensionOptions {
-        return { extensions: getSupportedExtensionsForModuleResolution(compilerOptions), includeExtensionsOption };
+        return { extensions: flatten(getSupportedExtensionsForModuleResolution(compilerOptions)), includeExtensionsOption };
     }
     function getCompletionEntriesForRelativeModules(literalValue: string, scriptDirectory: string, compilerOptions: CompilerOptions, host: LanguageServiceHost, scriptPath: Path, preferences: UserPreferences) {
         const includeExtensions = preferences.importModuleSpecifierEnding === "js" ? IncludeExtensionsOption.ModuleSpecifierCompletion : IncludeExtensionsOption.Exclude;
@@ -344,10 +344,10 @@ namespace ts.Completions.StringCompletions {
         }
     }
 
-    function getSupportedExtensionsForModuleResolution(compilerOptions: CompilerOptions): readonly Extension[] {
+    function getSupportedExtensionsForModuleResolution(compilerOptions: CompilerOptions): readonly Extension[][] {
         const extensions = getSupportedExtensions(compilerOptions);
-        return compilerOptions.resolveJsonModule && getEmitModuleResolutionKind(compilerOptions) === ModuleResolutionKind.NodeJs ?
-            extensions.concat(Extension.Json) :
+        return getEmitModuleResolutionKind(compilerOptions) === ModuleResolutionKind.NodeJs ?
+            getSupportedExtensionsWithJsonIfResolveJsonModule(compilerOptions, extensions) :
             extensions;
     }
 
diff --git a/src/testRunner/unittests/moduleResolution.ts b/src/testRunner/unittests/moduleResolution.ts
index a11978dab4993..390eb7857b521 100644
--- a/src/testRunner/unittests/moduleResolution.ts
+++ b/src/testRunner/unittests/moduleResolution.ts
@@ -82,9 +82,11 @@ namespace ts {
     }
 
     describe("unittests:: moduleResolution:: Node module resolution - relative paths", () => {
-
+        // node module resolution does _not_ implicitly append these extensions to an extensionless path (though will still attempt to load them if explicitly)
+        const nonImplicitExtensions = [Extension.Mts, Extension.Dmts, Extension.Mjs, Extension.Cts, Extension.Dcts, Extension.Cjs];
+        const autoExtensions = filter(supportedTSExtensionsFlat, e => nonImplicitExtensions.indexOf(e) === -1);
         function testLoadAsFile(containingFileName: string, moduleFileNameNoExt: string, moduleName: string): void {
-            for (const ext of supportedTSExtensions) {
+            for (const ext of autoExtensions) {
                 test(ext, /*hasDirectoryExists*/ false);
                 test(ext, /*hasDirectoryExists*/ true);
             }
@@ -97,7 +99,7 @@ namespace ts {
 
                 const failedLookupLocations: string[] = [];
                 const dir = getDirectoryPath(containingFileName);
-                for (const e of supportedTSExtensions) {
+                for (const e of autoExtensions) {
                     if (e === ext) {
                         break;
                     }
@@ -138,7 +140,7 @@ namespace ts {
                 const resolution = nodeModuleNameResolver(moduleName, containingFile.name, {}, createModuleResolutionHost(hasDirectoryExists, containingFile, packageJson, moduleFile));
                 checkResolvedModule(resolution.resolvedModule, createResolvedModule(moduleFile.name));
                 // expect three failed lookup location - attempt to load module as file with all supported extensions
-                assert.equal(resolution.failedLookupLocations.length, supportedTSExtensions.length);
+                assert.equal(resolution.failedLookupLocations.length, supportedTSExtensions[0].length);
             }
         }
 
diff --git a/src/testRunner/unittests/programApi.ts b/src/testRunner/unittests/programApi.ts
index b71d13e54cd7e..359dff1c03434 100644
--- a/src/testRunner/unittests/programApi.ts
+++ b/src/testRunner/unittests/programApi.ts
@@ -11,7 +11,7 @@ namespace ts {
         assert.equal(notFound.length, 0, `Not found ${notFound} in actual: ${missingPaths} expected: ${expected}`);
     }
 
-    describe("unittests:: Program.getMissingFilePaths", () => {
+    describe("unittests:: programApi:: Program.getMissingFilePaths", () => {
 
         const options: CompilerOptions = {
             noLib: true,
diff --git a/src/testRunner/unittests/tsbuild/moduleResolution.ts b/src/testRunner/unittests/tsbuild/moduleResolution.ts
index 7d9924f764165..0ac722293626f 100644
--- a/src/testRunner/unittests/tsbuild/moduleResolution.ts
+++ b/src/testRunner/unittests/tsbuild/moduleResolution.ts
@@ -66,6 +66,96 @@ namespace ts.tscWatch {
             changes: emptyArray
         });
 
+        verifyTscWatch({
+            scenario: "moduleResolution",
+            subScenario: `resolves specifier in output declaration file from referenced project correctly with cts and mts extensions`,
+            sys: () => createWatchedSystem([
+                {
+                    path: `${projectRoot}/packages/pkg1/package.json`,
+                    content: JSON.stringify({
+                        name: "pkg1",
+                        version: "1.0.0",
+                        main: "build/index.js",
+                        type: "module"
+                    })
+                },
+                {
+                    path: `${projectRoot}/packages/pkg1/index.ts`,
+                    content: Utils.dedent`
+                    import type { TheNum } from 'pkg2'
+                    export const theNum: TheNum = 42;`
+                },
+                {
+                    path: `${projectRoot}/packages/pkg1/tsconfig.json`,
+                    content: JSON.stringify({
+                        compilerOptions: {
+                            outDir: "build",
+                            module: "node12",
+                        },
+                        references: [{ path: "../pkg2" }]
+                    })
+                },
+                {
+                    path: `${projectRoot}/packages/pkg2/const.cts`,
+                    content: `export type TheNum = 42;`
+                },
+                {
+                    path: `${projectRoot}/packages/pkg2/index.ts`,
+                    content: `export type { TheNum } from './const.cjs';`
+                },
+                {
+                    path: `${projectRoot}/packages/pkg2/tsconfig.json`,
+                    content: JSON.stringify({
+                        compilerOptions: {
+                            composite: true,
+                            outDir: "build",
+                            module: "node12",
+                        }
+                    })
+                },
+                {
+                    path: `${projectRoot}/packages/pkg2/package.json`,
+                    content: JSON.stringify({
+                        name: "pkg2",
+                        version: "1.0.0",
+                        main: "build/index.js",
+                        type: "module"
+                    })
+                },
+                {
+                    path: `${projectRoot}/node_modules/pkg2`,
+                    symLink: `${projectRoot}/packages/pkg2`,
+                },
+                { ...libFile, path: `/a/lib/lib.es2020.full.d.ts` }
+            ], { currentDirectory: projectRoot }),
+            commandLineArgs: ["-b", "packages/pkg1", "-w", "--verbose", "--traceResolution"],
+            changes: [
+                {
+                    caption: "reports import errors after change to package file",
+                    change: sys => replaceFileText(sys, `${projectRoot}/packages/pkg1/package.json`, `"module"`, `"commonjs"`),
+                    timeouts: runQueuedTimeoutCallbacks,
+                },
+                {
+                    caption: "removes those errors when a package file is changed back",
+                    change: sys => replaceFileText(sys, `${projectRoot}/packages/pkg1/package.json`, `"commonjs"`, `"module"`),
+                    timeouts: runQueuedTimeoutCallbacks,
+                },
+                {
+                    caption: "reports import errors after change to package file",
+                    change: sys => replaceFileText(sys, `${projectRoot}/packages/pkg1/package.json`, `"module"`, `"commonjs"`),
+                    timeouts: runQueuedTimeoutCallbacks,
+                },
+                {
+                    caption: "removes those errors when a package file is changed to cjs extensions",
+                    change: sys => {
+                        replaceFileText(sys, `${projectRoot}/packages/pkg2/package.json`, `"build/index.js"`, `"build/index.cjs"`);
+                        sys.renameFile(`${projectRoot}/packages/pkg2/index.ts`, `${projectRoot}/packages/pkg2/index.cts`);
+                    },
+                    timeouts: runQueuedTimeoutCallbacks,
+                },
+            ]
+        });
+
         verifyTsc({
             scenario: "moduleResolution",
             subScenario: `type reference resolution uses correct options for different resolution options referenced project`,
diff --git a/src/testRunner/unittests/tscWatch/incremental.ts b/src/testRunner/unittests/tscWatch/incremental.ts
index bc6e541815a5c..8da2d0c09c4ba 100644
--- a/src/testRunner/unittests/tscWatch/incremental.ts
+++ b/src/testRunner/unittests/tscWatch/incremental.ts
@@ -163,16 +163,19 @@ namespace ts.tscWatch {
                         version: system.createHash(libFile.content),
                         signature: system.createHash(libFile.content),
                         affectsGlobalScope: true,
+                        impliedFormat: undefined,
                     });
                     assert.deepEqual(state.fileInfos.get(file1.path as Path), {
                         version: system.createHash(file1.content),
                         signature: system.createHash(file1.content),
                         affectsGlobalScope: undefined,
+                        impliedFormat: undefined,
                     });
                     assert.deepEqual(state.fileInfos.get(file2.path as Path), {
                         version: system.createHash(fileModified.content),
                         signature: system.createHash(fileModified.content),
                         affectsGlobalScope: undefined,
+                        impliedFormat: undefined,
                     });
 
                     assert.deepEqual(state.compilerOptions, {
diff --git a/tests/baselines/reference/api/tsserverlibrary.d.ts b/tests/baselines/reference/api/tsserverlibrary.d.ts
index 815d8d8e11e63..6e20852f32089 100644
--- a/tests/baselines/reference/api/tsserverlibrary.d.ts
+++ b/tests/baselines/reference/api/tsserverlibrary.d.ts
@@ -3206,6 +3206,10 @@ declare namespace ts {
         getNewLine(): string;
         readDirectory?(rootDir: string, extensions: readonly string[], excludes: readonly string[] | undefined, includes: readonly string[], depth?: number): string[];
         resolveModuleNames?(moduleNames: string[], containingFile: string, reusedNames: string[] | undefined, redirectedReference: ResolvedProjectReference | undefined, options: CompilerOptions): (ResolvedModule | undefined)[];
+        /**
+         * Returns the module resolution cache used by a provided `resolveModuleNames` implementation so that any non-name module resolution operations (eg, package.json lookup) can reuse it
+         */
+        getModuleResolutionCache?(): ModuleResolutionCache | undefined;
         /**
          * This method is a companion for 'resolveModuleNames' and is used to resolve 'types' references to actual type declaration files
          */
diff --git a/tests/baselines/reference/api/typescript.d.ts b/tests/baselines/reference/api/typescript.d.ts
index 036e1cabd9be6..b8215a5228e2f 100644
--- a/tests/baselines/reference/api/typescript.d.ts
+++ b/tests/baselines/reference/api/typescript.d.ts
@@ -3206,6 +3206,10 @@ declare namespace ts {
         getNewLine(): string;
         readDirectory?(rootDir: string, extensions: readonly string[], excludes: readonly string[] | undefined, includes: readonly string[], depth?: number): string[];
         resolveModuleNames?(moduleNames: string[], containingFile: string, reusedNames: string[] | undefined, redirectedReference: ResolvedProjectReference | undefined, options: CompilerOptions): (ResolvedModule | undefined)[];
+        /**
+         * Returns the module resolution cache used by a provided `resolveModuleNames` implementation so that any non-name module resolution operations (eg, package.json lookup) can reuse it
+         */
+        getModuleResolutionCache?(): ModuleResolutionCache | undefined;
         /**
          * This method is a companion for 'resolveModuleNames' and is used to resolve 'types' references to actual type declaration files
          */
diff --git a/tests/baselines/reference/declarationEmitInvalidReferenceAllowJs.errors.txt b/tests/baselines/reference/declarationEmitInvalidReferenceAllowJs.errors.txt
index 79f9afa5f34cb..c035c443cf289 100644
--- a/tests/baselines/reference/declarationEmitInvalidReferenceAllowJs.errors.txt
+++ b/tests/baselines/reference/declarationEmitInvalidReferenceAllowJs.errors.txt
@@ -1,9 +1,9 @@
-tests/cases/compiler/declarationEmitInvalidReferenceAllowJs.ts(1,22): error TS6231: Could not resolve the path 'tests/cases/compiler/invalid' with the extensions: '.ts', '.tsx', '.d.ts', '.js', '.jsx'.
+tests/cases/compiler/declarationEmitInvalidReferenceAllowJs.ts(1,22): error TS6231: Could not resolve the path 'tests/cases/compiler/invalid' with the extensions: '.ts', '.tsx', '.d.ts', '.js', '.jsx', '.cts', '.d.cts', '.cjs', '.mts', '.d.mts', '.mjs'.
 
 
 ==== tests/cases/compiler/declarationEmitInvalidReferenceAllowJs.ts (1 errors) ====
     /// <reference path="invalid" />
                          ~~~~~~~
-!!! error TS6231: Could not resolve the path 'tests/cases/compiler/invalid' with the extensions: '.ts', '.tsx', '.d.ts', '.js', '.jsx'.
+!!! error TS6231: Could not resolve the path 'tests/cases/compiler/invalid' with the extensions: '.ts', '.tsx', '.d.ts', '.js', '.jsx', '.cts', '.d.cts', '.cjs', '.mts', '.d.mts', '.mjs'.
     var x = 0; 
     
\ No newline at end of file
diff --git a/tests/baselines/reference/jsFileCompilationWithMapFileAsJs.errors.txt b/tests/baselines/reference/jsFileCompilationWithMapFileAsJs.errors.txt
index 1f078b80a0002..2520eedbc7f64 100644
--- a/tests/baselines/reference/jsFileCompilationWithMapFileAsJs.errors.txt
+++ b/tests/baselines/reference/jsFileCompilationWithMapFileAsJs.errors.txt
@@ -1,13 +1,13 @@
 error TS5055: Cannot write file 'tests/cases/compiler/b.js' because it would overwrite input file.
   Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig.
-error TS6054: File 'tests/cases/compiler/b.js.map' has an unsupported extension. The only supported extensions are '.ts', '.tsx', '.d.ts', '.js', '.jsx'.
+error TS6054: File 'tests/cases/compiler/b.js.map' has an unsupported extension. The only supported extensions are '.ts', '.tsx', '.d.ts', '.js', '.jsx', '.cts', '.d.cts', '.cjs', '.mts', '.d.mts', '.mjs'.
   The file is in the program because:
     Root file specified for compilation
 
 
 !!! error TS5055: Cannot write file 'tests/cases/compiler/b.js' because it would overwrite input file.
 !!! error TS5055:   Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig.
-!!! error TS6054: File 'tests/cases/compiler/b.js.map' has an unsupported extension. The only supported extensions are '.ts', '.tsx', '.d.ts', '.js', '.jsx'.
+!!! error TS6054: File 'tests/cases/compiler/b.js.map' has an unsupported extension. The only supported extensions are '.ts', '.tsx', '.d.ts', '.js', '.jsx', '.cts', '.d.cts', '.cjs', '.mts', '.d.mts', '.mjs'.
 !!! error TS6054:   The file is in the program because:
 !!! error TS6054:     Root file specified for compilation
 ==== tests/cases/compiler/a.ts (0 errors) ====
diff --git a/tests/baselines/reference/jsFileCompilationWithMapFileAsJsWithInlineSourceMap.errors.txt b/tests/baselines/reference/jsFileCompilationWithMapFileAsJsWithInlineSourceMap.errors.txt
index 1f078b80a0002..2520eedbc7f64 100644
--- a/tests/baselines/reference/jsFileCompilationWithMapFileAsJsWithInlineSourceMap.errors.txt
+++ b/tests/baselines/reference/jsFileCompilationWithMapFileAsJsWithInlineSourceMap.errors.txt
@@ -1,13 +1,13 @@
 error TS5055: Cannot write file 'tests/cases/compiler/b.js' because it would overwrite input file.
   Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig.
-error TS6054: File 'tests/cases/compiler/b.js.map' has an unsupported extension. The only supported extensions are '.ts', '.tsx', '.d.ts', '.js', '.jsx'.
+error TS6054: File 'tests/cases/compiler/b.js.map' has an unsupported extension. The only supported extensions are '.ts', '.tsx', '.d.ts', '.js', '.jsx', '.cts', '.d.cts', '.cjs', '.mts', '.d.mts', '.mjs'.
   The file is in the program because:
     Root file specified for compilation
 
 
 !!! error TS5055: Cannot write file 'tests/cases/compiler/b.js' because it would overwrite input file.
 !!! error TS5055:   Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig.
-!!! error TS6054: File 'tests/cases/compiler/b.js.map' has an unsupported extension. The only supported extensions are '.ts', '.tsx', '.d.ts', '.js', '.jsx'.
+!!! error TS6054: File 'tests/cases/compiler/b.js.map' has an unsupported extension. The only supported extensions are '.ts', '.tsx', '.d.ts', '.js', '.jsx', '.cts', '.d.cts', '.cjs', '.mts', '.d.mts', '.mjs'.
 !!! error TS6054:   The file is in the program because:
 !!! error TS6054:     Root file specified for compilation
 ==== tests/cases/compiler/a.ts (0 errors) ====
diff --git a/tests/baselines/reference/jsFileCompilationWithMapFileAsJsWithOutDir.errors.txt b/tests/baselines/reference/jsFileCompilationWithMapFileAsJsWithOutDir.errors.txt
index 5b421bbfc8642..321ab08822506 100644
--- a/tests/baselines/reference/jsFileCompilationWithMapFileAsJsWithOutDir.errors.txt
+++ b/tests/baselines/reference/jsFileCompilationWithMapFileAsJsWithOutDir.errors.txt
@@ -1,4 +1,4 @@
-error TS6054: File 'tests/cases/compiler/b.js.map' has an unsupported extension. The only supported extensions are '.ts', '.tsx', '.d.ts'.
+error TS6054: File 'tests/cases/compiler/b.js.map' has an unsupported extension. The only supported extensions are '.ts', '.tsx', '.d.ts', '.cts', '.d.cts', '.mts', '.d.mts'.
   The file is in the program because:
     Root file specified for compilation
 error TS6504: File 'tests/cases/compiler/b.js' is a JavaScript file. Did you mean to enable the 'allowJs' option?
@@ -6,7 +6,7 @@ error TS6504: File 'tests/cases/compiler/b.js' is a JavaScript file. Did you mea
     Root file specified for compilation
 
 
-!!! error TS6054: File 'tests/cases/compiler/b.js.map' has an unsupported extension. The only supported extensions are '.ts', '.tsx', '.d.ts'.
+!!! error TS6054: File 'tests/cases/compiler/b.js.map' has an unsupported extension. The only supported extensions are '.ts', '.tsx', '.d.ts', '.cts', '.d.cts', '.mts', '.d.mts'.
 !!! error TS6054:   The file is in the program because:
 !!! error TS6054:     Root file specified for compilation
 !!! error TS6504: File 'tests/cases/compiler/b.js' is a JavaScript file. Did you mean to enable the 'allowJs' option?
diff --git a/tests/baselines/reference/nodeModules1(module=node12).errors.txt b/tests/baselines/reference/nodeModules1(module=node12).errors.txt
new file mode 100644
index 0000000000000..a2f68a704a96f
--- /dev/null
+++ b/tests/baselines/reference/nodeModules1(module=node12).errors.txt
@@ -0,0 +1,158 @@
+tests/cases/conformance/node/index.cts(2,21): error TS1471: Module './index.js' cannot be imported using this construct. The specifier only resolves to an es module, which cannot be imported synchronously. Use dynamic import instead.
+tests/cases/conformance/node/index.cts(3,21): error TS1471: Module './index.mjs' cannot be imported using this construct. The specifier only resolves to an es module, which cannot be imported synchronously. Use dynamic import instead.
+tests/cases/conformance/node/index.cts(6,21): error TS1471: Module './subfolder/index.mjs' cannot be imported using this construct. The specifier only resolves to an es module, which cannot be imported synchronously. Use dynamic import instead.
+tests/cases/conformance/node/index.cts(9,21): error TS1471: Module './subfolder2/index.mjs' cannot be imported using this construct. The specifier only resolves to an es module, which cannot be imported synchronously. Use dynamic import instead.
+tests/cases/conformance/node/index.cts(11,22): error TS1471: Module './subfolder2/another/index.js' cannot be imported using this construct. The specifier only resolves to an es module, which cannot be imported synchronously. Use dynamic import instead.
+tests/cases/conformance/node/index.cts(12,22): error TS1471: Module './subfolder2/another/index.mjs' cannot be imported using this construct. The specifier only resolves to an es module, which cannot be imported synchronously. Use dynamic import instead.
+
+
+==== tests/cases/conformance/node/subfolder/index.ts (0 errors) ====
+    // cjs format file
+    const x = 1;
+    export {x};
+==== tests/cases/conformance/node/subfolder/index.cts (0 errors) ====
+    // cjs format file
+    const x = 1;
+    export {x};
+==== tests/cases/conformance/node/subfolder/index.mts (0 errors) ====
+    // esm format file
+    const x = 1;
+    export {x};
+==== tests/cases/conformance/node/subfolder2/index.ts (0 errors) ====
+    // cjs format file
+    const x = 1;
+    export {x};
+==== tests/cases/conformance/node/subfolder2/index.cts (0 errors) ====
+    // cjs format file
+    const x = 1;
+    export {x};
+==== tests/cases/conformance/node/subfolder2/index.mts (0 errors) ====
+    // esm format file
+    const x = 1;
+    export {x};
+==== tests/cases/conformance/node/subfolder2/another/index.ts (0 errors) ====
+    // esm format file
+    const x = 1;
+    export {x};
+==== tests/cases/conformance/node/subfolder2/another/index.mts (0 errors) ====
+    // esm format file
+    const x = 1;
+    export {x};
+==== tests/cases/conformance/node/subfolder2/another/index.cts (0 errors) ====
+    // cjs format file
+    const x = 1;
+    export {x};
+==== tests/cases/conformance/node/index.mts (0 errors) ====
+    import * as m1 from "./index.js";
+    import * as m2 from "./index.mjs";
+    import * as m3 from "./index.cjs";
+    import * as m4 from "./subfolder/index.js";
+    import * as m5 from "./subfolder/index.mjs";
+    import * as m6 from "./subfolder/index.cjs";
+    import * as m7 from "./subfolder2/index.js";
+    import * as m8 from "./subfolder2/index.mjs";
+    import * as m9 from "./subfolder2/index.cjs";
+    import * as m10 from "./subfolder2/another/index.js";
+    import * as m11 from "./subfolder2/another/index.mjs";
+    import * as m12 from "./subfolder2/another/index.cjs";
+    void m1;
+    void m2;
+    void m3;
+    void m4;
+    void m5;
+    void m6;
+    void m7;
+    void m8;
+    void m9;
+    void m10;
+    void m11;
+    void m12;
+    // esm format file
+    const x = 1;
+    export {x};
+==== tests/cases/conformance/node/index.cts (6 errors) ====
+    // ESM-format imports below should issue errors
+    import * as m1 from "./index.js";
+                        ~~~~~~~~~~~~
+!!! error TS1471: Module './index.js' cannot be imported using this construct. The specifier only resolves to an es module, which cannot be imported synchronously. Use dynamic import instead.
+    import * as m2 from "./index.mjs";
+                        ~~~~~~~~~~~~~
+!!! error TS1471: Module './index.mjs' cannot be imported using this construct. The specifier only resolves to an es module, which cannot be imported synchronously. Use dynamic import instead.
+    import * as m3 from "./index.cjs";
+    import * as m4 from "./subfolder/index.js";
+    import * as m5 from "./subfolder/index.mjs";
+                        ~~~~~~~~~~~~~~~~~~~~~~~
+!!! error TS1471: Module './subfolder/index.mjs' cannot be imported using this construct. The specifier only resolves to an es module, which cannot be imported synchronously. Use dynamic import instead.
+    import * as m6 from "./subfolder/index.cjs";
+    import * as m7 from "./subfolder2/index.js";
+    import * as m8 from "./subfolder2/index.mjs";
+                        ~~~~~~~~~~~~~~~~~~~~~~~~
+!!! error TS1471: Module './subfolder2/index.mjs' cannot be imported using this construct. The specifier only resolves to an es module, which cannot be imported synchronously. Use dynamic import instead.
+    import * as m9 from "./subfolder2/index.cjs";
+    import * as m10 from "./subfolder2/another/index.js";
+                         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+!!! error TS1471: Module './subfolder2/another/index.js' cannot be imported using this construct. The specifier only resolves to an es module, which cannot be imported synchronously. Use dynamic import instead.
+    import * as m11 from "./subfolder2/another/index.mjs";
+                         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+!!! error TS1471: Module './subfolder2/another/index.mjs' cannot be imported using this construct. The specifier only resolves to an es module, which cannot be imported synchronously. Use dynamic import instead.
+    import * as m12 from "./subfolder2/another/index.cjs";
+    void m1;
+    void m2;
+    void m3;
+    void m4;
+    void m5;
+    void m6;
+    void m7;
+    void m8;
+    void m9;
+    void m10;
+    void m11;
+    void m12;
+    // cjs format file
+    const x = 1;
+    export {x};
+==== tests/cases/conformance/node/index.ts (0 errors) ====
+    import * as m1 from "./index.js";
+    import * as m2 from "./index.mjs";
+    import * as m3 from "./index.cjs";
+    import * as m4 from "./subfolder/index.js";
+    import * as m5 from "./subfolder/index.mjs";
+    import * as m6 from "./subfolder/index.cjs";
+    import * as m7 from "./subfolder2/index.js";
+    import * as m8 from "./subfolder2/index.mjs";
+    import * as m9 from "./subfolder2/index.cjs";
+    import * as m10 from "./subfolder2/another/index.js";
+    import * as m11 from "./subfolder2/another/index.mjs";
+    import * as m12 from "./subfolder2/another/index.cjs";
+    void m1;
+    void m2;
+    void m3;
+    void m4;
+    void m5;
+    void m6;
+    void m7;
+    void m8;
+    void m9;
+    void m10;
+    void m11;
+    void m12;
+    // esm format file
+    const x = 1;
+    export {x};
+==== tests/cases/conformance/node/package.json (0 errors) ====
+    {
+        "name": "package",
+        "private": true,
+        "type": "module"
+    }
+==== tests/cases/conformance/node/subfolder/package.json (0 errors) ====
+    {
+        "type": "commonjs"
+    }
+==== tests/cases/conformance/node/subfolder2/package.json (0 errors) ====
+    {
+    }
+==== tests/cases/conformance/node/subfolder2/another/package.json (0 errors) ====
+    {
+        "type": "module"
+    }
\ No newline at end of file
diff --git a/tests/baselines/reference/nodeModules1(module=node12).js b/tests/baselines/reference/nodeModules1(module=node12).js
index 1acae5c9aab3b..fba5f41f193e3 100644
--- a/tests/baselines/reference/nodeModules1(module=node12).js
+++ b/tests/baselines/reference/nodeModules1(module=node12).js
@@ -4,15 +4,120 @@
 // cjs format file
 const x = 1;
 export {x};
+//// [index.cts]
+// cjs format file
+const x = 1;
+export {x};
+//// [index.mts]
+// esm format file
+const x = 1;
+export {x};
 //// [index.ts]
 // cjs format file
 const x = 1;
 export {x};
+//// [index.cts]
+// cjs format file
+const x = 1;
+export {x};
+//// [index.mts]
+// esm format file
+const x = 1;
+export {x};
 //// [index.ts]
 // esm format file
 const x = 1;
 export {x};
+//// [index.mts]
+// esm format file
+const x = 1;
+export {x};
+//// [index.cts]
+// cjs format file
+const x = 1;
+export {x};
+//// [index.mts]
+import * as m1 from "./index.js";
+import * as m2 from "./index.mjs";
+import * as m3 from "./index.cjs";
+import * as m4 from "./subfolder/index.js";
+import * as m5 from "./subfolder/index.mjs";
+import * as m6 from "./subfolder/index.cjs";
+import * as m7 from "./subfolder2/index.js";
+import * as m8 from "./subfolder2/index.mjs";
+import * as m9 from "./subfolder2/index.cjs";
+import * as m10 from "./subfolder2/another/index.js";
+import * as m11 from "./subfolder2/another/index.mjs";
+import * as m12 from "./subfolder2/another/index.cjs";
+void m1;
+void m2;
+void m3;
+void m4;
+void m5;
+void m6;
+void m7;
+void m8;
+void m9;
+void m10;
+void m11;
+void m12;
+// esm format file
+const x = 1;
+export {x};
+//// [index.cts]
+// ESM-format imports below should issue errors
+import * as m1 from "./index.js";
+import * as m2 from "./index.mjs";
+import * as m3 from "./index.cjs";
+import * as m4 from "./subfolder/index.js";
+import * as m5 from "./subfolder/index.mjs";
+import * as m6 from "./subfolder/index.cjs";
+import * as m7 from "./subfolder2/index.js";
+import * as m8 from "./subfolder2/index.mjs";
+import * as m9 from "./subfolder2/index.cjs";
+import * as m10 from "./subfolder2/another/index.js";
+import * as m11 from "./subfolder2/another/index.mjs";
+import * as m12 from "./subfolder2/another/index.cjs";
+void m1;
+void m2;
+void m3;
+void m4;
+void m5;
+void m6;
+void m7;
+void m8;
+void m9;
+void m10;
+void m11;
+void m12;
+// cjs format file
+const x = 1;
+export {x};
 //// [index.ts]
+import * as m1 from "./index.js";
+import * as m2 from "./index.mjs";
+import * as m3 from "./index.cjs";
+import * as m4 from "./subfolder/index.js";
+import * as m5 from "./subfolder/index.mjs";
+import * as m6 from "./subfolder/index.cjs";
+import * as m7 from "./subfolder2/index.js";
+import * as m8 from "./subfolder2/index.mjs";
+import * as m9 from "./subfolder2/index.cjs";
+import * as m10 from "./subfolder2/another/index.js";
+import * as m11 from "./subfolder2/another/index.mjs";
+import * as m12 from "./subfolder2/another/index.cjs";
+void m1;
+void m2;
+void m3;
+void m4;
+void m5;
+void m6;
+void m7;
+void m8;
+void m9;
+void m10;
+void m11;
+void m12;
 // esm format file
 const x = 1;
 export {x};
@@ -41,6 +146,17 @@ exports.x = void 0;
 // cjs format file
 const x = 1;
 exports.x = x;
+//// [index.cjs]
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.x = void 0;
+// cjs format file
+const x = 1;
+exports.x = x;
+//// [index.mjs]
+// esm format file
+const x = 1;
+export { x };
 //// [index.js]
 "use strict";
 Object.defineProperty(exports, "__esModule", { value: true });
@@ -48,25 +164,174 @@ exports.x = void 0;
 // cjs format file
 const x = 1;
 exports.x = x;
+//// [index.cjs]
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.x = void 0;
+// cjs format file
+const x = 1;
+exports.x = x;
+//// [index.mjs]
+// esm format file
+const x = 1;
+export { x };
 //// [index.js]
 // esm format file
 const x = 1;
 export { x };
+//// [index.mjs]
+// esm format file
+const x = 1;
+export { x };
+//// [index.cjs]
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.x = void 0;
+// cjs format file
+const x = 1;
+exports.x = x;
 //// [index.js]
+import * as m1 from "./index.js";
+import * as m2 from "./index.mjs";
+import * as m3 from "./index.cjs";
+import * as m4 from "./subfolder/index.js";
+import * as m5 from "./subfolder/index.mjs";
+import * as m6 from "./subfolder/index.cjs";
+import * as m7 from "./subfolder2/index.js";
+import * as m8 from "./subfolder2/index.mjs";
+import * as m9 from "./subfolder2/index.cjs";
+import * as m10 from "./subfolder2/another/index.js";
+import * as m11 from "./subfolder2/another/index.mjs";
+import * as m12 from "./subfolder2/another/index.cjs";
+void m1;
+void m2;
+void m3;
+void m4;
+void m5;
+void m6;
+void m7;
+void m8;
+void m9;
+void m10;
+void m11;
+void m12;
 // esm format file
 const x = 1;
 export { x };
+//// [index.mjs]
+import * as m1 from "./index.js";
+import * as m2 from "./index.mjs";
+import * as m3 from "./index.cjs";
+import * as m4 from "./subfolder/index.js";
+import * as m5 from "./subfolder/index.mjs";
+import * as m6 from "./subfolder/index.cjs";
+import * as m7 from "./subfolder2/index.js";
+import * as m8 from "./subfolder2/index.mjs";
+import * as m9 from "./subfolder2/index.cjs";
+import * as m10 from "./subfolder2/another/index.js";
+import * as m11 from "./subfolder2/another/index.mjs";
+import * as m12 from "./subfolder2/another/index.cjs";
+void m1;
+void m2;
+void m3;
+void m4;
+void m5;
+void m6;
+void m7;
+void m8;
+void m9;
+void m10;
+void m11;
+void m12;
+// esm format file
+const x = 1;
+export { x };
+//// [index.cjs]
+"use strict";
+var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
+    if (k2 === undefined) k2 = k;
+    Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
+}) : (function(o, m, k, k2) {
+    if (k2 === undefined) k2 = k;
+    o[k2] = m[k];
+}));
+var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
+    Object.defineProperty(o, "default", { enumerable: true, value: v });
+}) : function(o, v) {
+    o["default"] = v;
+});
+var __importStar = (this && this.__importStar) || function (mod) {
+    if (mod && mod.__esModule) return mod;
+    var result = {};
+    if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
+    __setModuleDefault(result, mod);
+    return result;
+};
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.x = void 0;
+// ESM-format imports below should issue errors
+const m1 = __importStar(require("./index.js"));
+const m2 = __importStar(require("./index.mjs"));
+const m3 = __importStar(require("./index.cjs"));
+const m4 = __importStar(require("./subfolder/index.js"));
+const m5 = __importStar(require("./subfolder/index.mjs"));
+const m6 = __importStar(require("./subfolder/index.cjs"));
+const m7 = __importStar(require("./subfolder2/index.js"));
+const m8 = __importStar(require("./subfolder2/index.mjs"));
+const m9 = __importStar(require("./subfolder2/index.cjs"));
+const m10 = __importStar(require("./subfolder2/another/index.js"));
+const m11 = __importStar(require("./subfolder2/another/index.mjs"));
+const m12 = __importStar(require("./subfolder2/another/index.cjs"));
+void m1;
+void m2;
+void m3;
+void m4;
+void m5;
+void m6;
+void m7;
+void m8;
+void m9;
+void m10;
+void m11;
+void m12;
+// cjs format file
+const x = 1;
+exports.x = x;
 
 
 //// [index.d.ts]
 declare const x = 1;
 export { x };
+//// [index.d.cts]
+declare const x = 1;
+export { x };
+//// [index.d.mts]
+declare const x = 1;
+export { x };
 //// [index.d.ts]
 declare const x = 1;
 export { x };
+//// [index.d.cts]
+declare const x = 1;
+export { x };
+//// [index.d.mts]
+declare const x = 1;
+export { x };
 //// [index.d.ts]
 declare const x = 1;
 export { x };
+//// [index.d.mts]
+declare const x = 1;
+export { x };
+//// [index.d.cts]
+declare const x = 1;
+export { x };
 //// [index.d.ts]
 declare const x = 1;
 export { x };
+//// [index.d.mts]
+declare const x = 1;
+export { x };
+//// [index.d.cts]
+declare const x = 1;
+export { x };
diff --git a/tests/baselines/reference/nodeModules1(module=node12).symbols b/tests/baselines/reference/nodeModules1(module=node12).symbols
index e1653429c87db..b8caa52c8cfa0 100644
--- a/tests/baselines/reference/nodeModules1(module=node12).symbols
+++ b/tests/baselines/reference/nodeModules1(module=node12).symbols
@@ -6,6 +6,22 @@ const x = 1;
 export {x};
 >x : Symbol(x, Decl(index.ts, 2, 8))
 
+=== tests/cases/conformance/node/subfolder/index.cts ===
+// cjs format file
+const x = 1;
+>x : Symbol(x, Decl(index.cts, 1, 5))
+
+export {x};
+>x : Symbol(x, Decl(index.cts, 2, 8))
+
+=== tests/cases/conformance/node/subfolder/index.mts ===
+// esm format file
+const x = 1;
+>x : Symbol(x, Decl(index.mts, 1, 5))
+
+export {x};
+>x : Symbol(x, Decl(index.mts, 2, 8))
+
 === tests/cases/conformance/node/subfolder2/index.ts ===
 // cjs format file
 const x = 1;
@@ -14,6 +30,22 @@ const x = 1;
 export {x};
 >x : Symbol(x, Decl(index.ts, 2, 8))
 
+=== tests/cases/conformance/node/subfolder2/index.cts ===
+// cjs format file
+const x = 1;
+>x : Symbol(x, Decl(index.cts, 1, 5))
+
+export {x};
+>x : Symbol(x, Decl(index.cts, 2, 8))
+
+=== tests/cases/conformance/node/subfolder2/index.mts ===
+// esm format file
+const x = 1;
+>x : Symbol(x, Decl(index.mts, 1, 5))
+
+export {x};
+>x : Symbol(x, Decl(index.mts, 2, 8))
+
 === tests/cases/conformance/node/subfolder2/another/index.ts ===
 // esm format file
 const x = 1;
@@ -22,11 +54,260 @@ const x = 1;
 export {x};
 >x : Symbol(x, Decl(index.ts, 2, 8))
 
+=== tests/cases/conformance/node/subfolder2/another/index.mts ===
+// esm format file
+const x = 1;
+>x : Symbol(x, Decl(index.mts, 1, 5))
+
+export {x};
+>x : Symbol(x, Decl(index.mts, 2, 8))
+
+=== tests/cases/conformance/node/subfolder2/another/index.cts ===
+// cjs format file
+const x = 1;
+>x : Symbol(x, Decl(index.cts, 1, 5))
+
+export {x};
+>x : Symbol(x, Decl(index.cts, 2, 8))
+
+=== tests/cases/conformance/node/index.mts ===
+import * as m1 from "./index.js";
+>m1 : Symbol(m1, Decl(index.mts, 0, 6))
+
+import * as m2 from "./index.mjs";
+>m2 : Symbol(m2, Decl(index.mts, 1, 6))
+
+import * as m3 from "./index.cjs";
+>m3 : Symbol(m3, Decl(index.mts, 2, 6))
+
+import * as m4 from "./subfolder/index.js";
+>m4 : Symbol(m4, Decl(index.mts, 3, 6))
+
+import * as m5 from "./subfolder/index.mjs";
+>m5 : Symbol(m5, Decl(index.mts, 4, 6))
+
+import * as m6 from "./subfolder/index.cjs";
+>m6 : Symbol(m6, Decl(index.mts, 5, 6))
+
+import * as m7 from "./subfolder2/index.js";
+>m7 : Symbol(m7, Decl(index.mts, 6, 6))
+
+import * as m8 from "./subfolder2/index.mjs";
+>m8 : Symbol(m8, Decl(index.mts, 7, 6))
+
+import * as m9 from "./subfolder2/index.cjs";
+>m9 : Symbol(m9, Decl(index.mts, 8, 6))
+
+import * as m10 from "./subfolder2/another/index.js";
+>m10 : Symbol(m10, Decl(index.mts, 9, 6))
+
+import * as m11 from "./subfolder2/another/index.mjs";
+>m11 : Symbol(m11, Decl(index.mts, 10, 6))
+
+import * as m12 from "./subfolder2/another/index.cjs";
+>m12 : Symbol(m12, Decl(index.mts, 11, 6))
+
+void m1;
+>m1 : Symbol(m1, Decl(index.mts, 0, 6))
+
+void m2;
+>m2 : Symbol(m2, Decl(index.mts, 1, 6))
+
+void m3;
+>m3 : Symbol(m3, Decl(index.mts, 2, 6))
+
+void m4;
+>m4 : Symbol(m4, Decl(index.mts, 3, 6))
+
+void m5;
+>m5 : Symbol(m5, Decl(index.mts, 4, 6))
+
+void m6;
+>m6 : Symbol(m6, Decl(index.mts, 5, 6))
+
+void m7;
+>m7 : Symbol(m7, Decl(index.mts, 6, 6))
+
+void m8;
+>m8 : Symbol(m8, Decl(index.mts, 7, 6))
+
+void m9;
+>m9 : Symbol(m9, Decl(index.mts, 8, 6))
+
+void m10;
+>m10 : Symbol(m10, Decl(index.mts, 9, 6))
+
+void m11;
+>m11 : Symbol(m11, Decl(index.mts, 10, 6))
+
+void m12;
+>m12 : Symbol(m12, Decl(index.mts, 11, 6))
+
+// esm format file
+const x = 1;
+>x : Symbol(x, Decl(index.mts, 25, 5))
+
+export {x};
+>x : Symbol(m2.x, Decl(index.mts, 26, 8))
+
+=== tests/cases/conformance/node/index.cts ===
+// ESM-format imports below should issue errors
+import * as m1 from "./index.js";
+>m1 : Symbol(m1, Decl(index.cts, 1, 6))
+
+import * as m2 from "./index.mjs";
+>m2 : Symbol(m2, Decl(index.cts, 2, 6))
+
+import * as m3 from "./index.cjs";
+>m3 : Symbol(m3, Decl(index.cts, 3, 6))
+
+import * as m4 from "./subfolder/index.js";
+>m4 : Symbol(m4, Decl(index.cts, 4, 6))
+
+import * as m5 from "./subfolder/index.mjs";
+>m5 : Symbol(m5, Decl(index.cts, 5, 6))
+
+import * as m6 from "./subfolder/index.cjs";
+>m6 : Symbol(m6, Decl(index.cts, 6, 6))
+
+import * as m7 from "./subfolder2/index.js";
+>m7 : Symbol(m7, Decl(index.cts, 7, 6))
+
+import * as m8 from "./subfolder2/index.mjs";
+>m8 : Symbol(m8, Decl(index.cts, 8, 6))
+
+import * as m9 from "./subfolder2/index.cjs";
+>m9 : Symbol(m9, Decl(index.cts, 9, 6))
+
+import * as m10 from "./subfolder2/another/index.js";
+>m10 : Symbol(m10, Decl(index.cts, 10, 6))
+
+import * as m11 from "./subfolder2/another/index.mjs";
+>m11 : Symbol(m11, Decl(index.cts, 11, 6))
+
+import * as m12 from "./subfolder2/another/index.cjs";
+>m12 : Symbol(m12, Decl(index.cts, 12, 6))
+
+void m1;
+>m1 : Symbol(m1, Decl(index.cts, 1, 6))
+
+void m2;
+>m2 : Symbol(m2, Decl(index.cts, 2, 6))
+
+void m3;
+>m3 : Symbol(m3, Decl(index.cts, 3, 6))
+
+void m4;
+>m4 : Symbol(m4, Decl(index.cts, 4, 6))
+
+void m5;
+>m5 : Symbol(m5, Decl(index.cts, 5, 6))
+
+void m6;
+>m6 : Symbol(m6, Decl(index.cts, 6, 6))
+
+void m7;
+>m7 : Symbol(m7, Decl(index.cts, 7, 6))
+
+void m8;
+>m8 : Symbol(m8, Decl(index.cts, 8, 6))
+
+void m9;
+>m9 : Symbol(m9, Decl(index.cts, 9, 6))
+
+void m10;
+>m10 : Symbol(m10, Decl(index.cts, 10, 6))
+
+void m11;
+>m11 : Symbol(m11, Decl(index.cts, 11, 6))
+
+void m12;
+>m12 : Symbol(m12, Decl(index.cts, 12, 6))
+
+// cjs format file
+const x = 1;
+>x : Symbol(x, Decl(index.cts, 26, 5))
+
+export {x};
+>x : Symbol(m3.x, Decl(index.cts, 27, 8))
+
 === tests/cases/conformance/node/index.ts ===
+import * as m1 from "./index.js";
+>m1 : Symbol(m1, Decl(index.ts, 0, 6))
+
+import * as m2 from "./index.mjs";
+>m2 : Symbol(m2, Decl(index.ts, 1, 6))
+
+import * as m3 from "./index.cjs";
+>m3 : Symbol(m3, Decl(index.ts, 2, 6))
+
+import * as m4 from "./subfolder/index.js";
+>m4 : Symbol(m4, Decl(index.ts, 3, 6))
+
+import * as m5 from "./subfolder/index.mjs";
+>m5 : Symbol(m5, Decl(index.ts, 4, 6))
+
+import * as m6 from "./subfolder/index.cjs";
+>m6 : Symbol(m6, Decl(index.ts, 5, 6))
+
+import * as m7 from "./subfolder2/index.js";
+>m7 : Symbol(m7, Decl(index.ts, 6, 6))
+
+import * as m8 from "./subfolder2/index.mjs";
+>m8 : Symbol(m8, Decl(index.ts, 7, 6))
+
+import * as m9 from "./subfolder2/index.cjs";
+>m9 : Symbol(m9, Decl(index.ts, 8, 6))
+
+import * as m10 from "./subfolder2/another/index.js";
+>m10 : Symbol(m10, Decl(index.ts, 9, 6))
+
+import * as m11 from "./subfolder2/another/index.mjs";
+>m11 : Symbol(m11, Decl(index.ts, 10, 6))
+
+import * as m12 from "./subfolder2/another/index.cjs";
+>m12 : Symbol(m12, Decl(index.ts, 11, 6))
+
+void m1;
+>m1 : Symbol(m1, Decl(index.ts, 0, 6))
+
+void m2;
+>m2 : Symbol(m2, Decl(index.ts, 1, 6))
+
+void m3;
+>m3 : Symbol(m3, Decl(index.ts, 2, 6))
+
+void m4;
+>m4 : Symbol(m4, Decl(index.ts, 3, 6))
+
+void m5;
+>m5 : Symbol(m5, Decl(index.ts, 4, 6))
+
+void m6;
+>m6 : Symbol(m6, Decl(index.ts, 5, 6))
+
+void m7;
+>m7 : Symbol(m7, Decl(index.ts, 6, 6))
+
+void m8;
+>m8 : Symbol(m8, Decl(index.ts, 7, 6))
+
+void m9;
+>m9 : Symbol(m9, Decl(index.ts, 8, 6))
+
+void m10;
+>m10 : Symbol(m10, Decl(index.ts, 9, 6))
+
+void m11;
+>m11 : Symbol(m11, Decl(index.ts, 10, 6))
+
+void m12;
+>m12 : Symbol(m12, Decl(index.ts, 11, 6))
+
 // esm format file
 const x = 1;
->x : Symbol(x, Decl(index.ts, 1, 5))
+>x : Symbol(x, Decl(index.ts, 25, 5))
 
 export {x};
->x : Symbol(x, Decl(index.ts, 2, 8))
+>x : Symbol(m1.x, Decl(index.ts, 26, 8))
 
diff --git a/tests/baselines/reference/nodeModules1(module=node12).types b/tests/baselines/reference/nodeModules1(module=node12).types
index 1c479a5e7bd48..cf878a592d2e9 100644
--- a/tests/baselines/reference/nodeModules1(module=node12).types
+++ b/tests/baselines/reference/nodeModules1(module=node12).types
@@ -7,6 +7,24 @@ const x = 1;
 export {x};
 >x : 1
 
+=== tests/cases/conformance/node/subfolder/index.cts ===
+// cjs format file
+const x = 1;
+>x : 1
+>1 : 1
+
+export {x};
+>x : 1
+
+=== tests/cases/conformance/node/subfolder/index.mts ===
+// esm format file
+const x = 1;
+>x : 1
+>1 : 1
+
+export {x};
+>x : 1
+
 === tests/cases/conformance/node/subfolder2/index.ts ===
 // cjs format file
 const x = 1;
@@ -16,6 +34,24 @@ const x = 1;
 export {x};
 >x : 1
 
+=== tests/cases/conformance/node/subfolder2/index.cts ===
+// cjs format file
+const x = 1;
+>x : 1
+>1 : 1
+
+export {x};
+>x : 1
+
+=== tests/cases/conformance/node/subfolder2/index.mts ===
+// esm format file
+const x = 1;
+>x : 1
+>1 : 1
+
+export {x};
+>x : 1
+
 === tests/cases/conformance/node/subfolder2/another/index.ts ===
 // esm format file
 const x = 1;
@@ -25,7 +61,296 @@ const x = 1;
 export {x};
 >x : 1
 
+=== tests/cases/conformance/node/subfolder2/another/index.mts ===
+// esm format file
+const x = 1;
+>x : 1
+>1 : 1
+
+export {x};
+>x : 1
+
+=== tests/cases/conformance/node/subfolder2/another/index.cts ===
+// cjs format file
+const x = 1;
+>x : 1
+>1 : 1
+
+export {x};
+>x : 1
+
+=== tests/cases/conformance/node/index.mts ===
+import * as m1 from "./index.js";
+>m1 : typeof m1
+
+import * as m2 from "./index.mjs";
+>m2 : typeof m2
+
+import * as m3 from "./index.cjs";
+>m3 : typeof m3
+
+import * as m4 from "./subfolder/index.js";
+>m4 : typeof m4
+
+import * as m5 from "./subfolder/index.mjs";
+>m5 : typeof m5
+
+import * as m6 from "./subfolder/index.cjs";
+>m6 : typeof m6
+
+import * as m7 from "./subfolder2/index.js";
+>m7 : typeof m7
+
+import * as m8 from "./subfolder2/index.mjs";
+>m8 : typeof m8
+
+import * as m9 from "./subfolder2/index.cjs";
+>m9 : typeof m9
+
+import * as m10 from "./subfolder2/another/index.js";
+>m10 : typeof m10
+
+import * as m11 from "./subfolder2/another/index.mjs";
+>m11 : typeof m11
+
+import * as m12 from "./subfolder2/another/index.cjs";
+>m12 : typeof m12
+
+void m1;
+>void m1 : undefined
+>m1 : typeof m1
+
+void m2;
+>void m2 : undefined
+>m2 : typeof m2
+
+void m3;
+>void m3 : undefined
+>m3 : typeof m3
+
+void m4;
+>void m4 : undefined
+>m4 : typeof m4
+
+void m5;
+>void m5 : undefined
+>m5 : typeof m5
+
+void m6;
+>void m6 : undefined
+>m6 : typeof m6
+
+void m7;
+>void m7 : undefined
+>m7 : typeof m7
+
+void m8;
+>void m8 : undefined
+>m8 : typeof m8
+
+void m9;
+>void m9 : undefined
+>m9 : typeof m9
+
+void m10;
+>void m10 : undefined
+>m10 : typeof m10
+
+void m11;
+>void m11 : undefined
+>m11 : typeof m11
+
+void m12;
+>void m12 : undefined
+>m12 : typeof m12
+
+// esm format file
+const x = 1;
+>x : 1
+>1 : 1
+
+export {x};
+>x : 1
+
+=== tests/cases/conformance/node/index.cts ===
+// ESM-format imports below should issue errors
+import * as m1 from "./index.js";
+>m1 : typeof m1
+
+import * as m2 from "./index.mjs";
+>m2 : typeof m2
+
+import * as m3 from "./index.cjs";
+>m3 : typeof m3
+
+import * as m4 from "./subfolder/index.js";
+>m4 : typeof m4
+
+import * as m5 from "./subfolder/index.mjs";
+>m5 : typeof m5
+
+import * as m6 from "./subfolder/index.cjs";
+>m6 : typeof m6
+
+import * as m7 from "./subfolder2/index.js";
+>m7 : typeof m7
+
+import * as m8 from "./subfolder2/index.mjs";
+>m8 : typeof m8
+
+import * as m9 from "./subfolder2/index.cjs";
+>m9 : typeof m9
+
+import * as m10 from "./subfolder2/another/index.js";
+>m10 : typeof m10
+
+import * as m11 from "./subfolder2/another/index.mjs";
+>m11 : typeof m11
+
+import * as m12 from "./subfolder2/another/index.cjs";
+>m12 : typeof m12
+
+void m1;
+>void m1 : undefined
+>m1 : typeof m1
+
+void m2;
+>void m2 : undefined
+>m2 : typeof m2
+
+void m3;
+>void m3 : undefined
+>m3 : typeof m3
+
+void m4;
+>void m4 : undefined
+>m4 : typeof m4
+
+void m5;
+>void m5 : undefined
+>m5 : typeof m5
+
+void m6;
+>void m6 : undefined
+>m6 : typeof m6
+
+void m7;
+>void m7 : undefined
+>m7 : typeof m7
+
+void m8;
+>void m8 : undefined
+>m8 : typeof m8
+
+void m9;
+>void m9 : undefined
+>m9 : typeof m9
+
+void m10;
+>void m10 : undefined
+>m10 : typeof m10
+
+void m11;
+>void m11 : undefined
+>m11 : typeof m11
+
+void m12;
+>void m12 : undefined
+>m12 : typeof m12
+
+// cjs format file
+const x = 1;
+>x : 1
+>1 : 1
+
+export {x};
+>x : 1
+
 === tests/cases/conformance/node/index.ts ===
+import * as m1 from "./index.js";
+>m1 : typeof m1
+
+import * as m2 from "./index.mjs";
+>m2 : typeof m2
+
+import * as m3 from "./index.cjs";
+>m3 : typeof m3
+
+import * as m4 from "./subfolder/index.js";
+>m4 : typeof m4
+
+import * as m5 from "./subfolder/index.mjs";
+>m5 : typeof m5
+
+import * as m6 from "./subfolder/index.cjs";
+>m6 : typeof m6
+
+import * as m7 from "./subfolder2/index.js";
+>m7 : typeof m7
+
+import * as m8 from "./subfolder2/index.mjs";
+>m8 : typeof m8
+
+import * as m9 from "./subfolder2/index.cjs";
+>m9 : typeof m9
+
+import * as m10 from "./subfolder2/another/index.js";
+>m10 : typeof m10
+
+import * as m11 from "./subfolder2/another/index.mjs";
+>m11 : typeof m11
+
+import * as m12 from "./subfolder2/another/index.cjs";
+>m12 : typeof m12
+
+void m1;
+>void m1 : undefined
+>m1 : typeof m1
+
+void m2;
+>void m2 : undefined
+>m2 : typeof m2
+
+void m3;
+>void m3 : undefined
+>m3 : typeof m3
+
+void m4;
+>void m4 : undefined
+>m4 : typeof m4
+
+void m5;
+>void m5 : undefined
+>m5 : typeof m5
+
+void m6;
+>void m6 : undefined
+>m6 : typeof m6
+
+void m7;
+>void m7 : undefined
+>m7 : typeof m7
+
+void m8;
+>void m8 : undefined
+>m8 : typeof m8
+
+void m9;
+>void m9 : undefined
+>m9 : typeof m9
+
+void m10;
+>void m10 : undefined
+>m10 : typeof m10
+
+void m11;
+>void m11 : undefined
+>m11 : typeof m11
+
+void m12;
+>void m12 : undefined
+>m12 : typeof m12
+
 // esm format file
 const x = 1;
 >x : 1
diff --git a/tests/baselines/reference/nodeModules1(module=nodenext).errors.txt b/tests/baselines/reference/nodeModules1(module=nodenext).errors.txt
new file mode 100644
index 0000000000000..a2f68a704a96f
--- /dev/null
+++ b/tests/baselines/reference/nodeModules1(module=nodenext).errors.txt
@@ -0,0 +1,158 @@
+tests/cases/conformance/node/index.cts(2,21): error TS1471: Module './index.js' cannot be imported using this construct. The specifier only resolves to an es module, which cannot be imported synchronously. Use dynamic import instead.
+tests/cases/conformance/node/index.cts(3,21): error TS1471: Module './index.mjs' cannot be imported using this construct. The specifier only resolves to an es module, which cannot be imported synchronously. Use dynamic import instead.
+tests/cases/conformance/node/index.cts(6,21): error TS1471: Module './subfolder/index.mjs' cannot be imported using this construct. The specifier only resolves to an es module, which cannot be imported synchronously. Use dynamic import instead.
+tests/cases/conformance/node/index.cts(9,21): error TS1471: Module './subfolder2/index.mjs' cannot be imported using this construct. The specifier only resolves to an es module, which cannot be imported synchronously. Use dynamic import instead.
+tests/cases/conformance/node/index.cts(11,22): error TS1471: Module './subfolder2/another/index.js' cannot be imported using this construct. The specifier only resolves to an es module, which cannot be imported synchronously. Use dynamic import instead.
+tests/cases/conformance/node/index.cts(12,22): error TS1471: Module './subfolder2/another/index.mjs' cannot be imported using this construct. The specifier only resolves to an es module, which cannot be imported synchronously. Use dynamic import instead.
+
+
+==== tests/cases/conformance/node/subfolder/index.ts (0 errors) ====
+    // cjs format file
+    const x = 1;
+    export {x};
+==== tests/cases/conformance/node/subfolder/index.cts (0 errors) ====
+    // cjs format file
+    const x = 1;
+    export {x};
+==== tests/cases/conformance/node/subfolder/index.mts (0 errors) ====
+    // esm format file
+    const x = 1;
+    export {x};
+==== tests/cases/conformance/node/subfolder2/index.ts (0 errors) ====
+    // cjs format file
+    const x = 1;
+    export {x};
+==== tests/cases/conformance/node/subfolder2/index.cts (0 errors) ====
+    // cjs format file
+    const x = 1;
+    export {x};
+==== tests/cases/conformance/node/subfolder2/index.mts (0 errors) ====
+    // esm format file
+    const x = 1;
+    export {x};
+==== tests/cases/conformance/node/subfolder2/another/index.ts (0 errors) ====
+    // esm format file
+    const x = 1;
+    export {x};
+==== tests/cases/conformance/node/subfolder2/another/index.mts (0 errors) ====
+    // esm format file
+    const x = 1;
+    export {x};
+==== tests/cases/conformance/node/subfolder2/another/index.cts (0 errors) ====
+    // cjs format file
+    const x = 1;
+    export {x};
+==== tests/cases/conformance/node/index.mts (0 errors) ====
+    import * as m1 from "./index.js";
+    import * as m2 from "./index.mjs";
+    import * as m3 from "./index.cjs";
+    import * as m4 from "./subfolder/index.js";
+    import * as m5 from "./subfolder/index.mjs";
+    import * as m6 from "./subfolder/index.cjs";
+    import * as m7 from "./subfolder2/index.js";
+    import * as m8 from "./subfolder2/index.mjs";
+    import * as m9 from "./subfolder2/index.cjs";
+    import * as m10 from "./subfolder2/another/index.js";
+    import * as m11 from "./subfolder2/another/index.mjs";
+    import * as m12 from "./subfolder2/another/index.cjs";
+    void m1;
+    void m2;
+    void m3;
+    void m4;
+    void m5;
+    void m6;
+    void m7;
+    void m8;
+    void m9;
+    void m10;
+    void m11;
+    void m12;
+    // esm format file
+    const x = 1;
+    export {x};
+==== tests/cases/conformance/node/index.cts (6 errors) ====
+    // ESM-format imports below should issue errors
+    import * as m1 from "./index.js";
+                        ~~~~~~~~~~~~
+!!! error TS1471: Module './index.js' cannot be imported using this construct. The specifier only resolves to an es module, which cannot be imported synchronously. Use dynamic import instead.
+    import * as m2 from "./index.mjs";
+                        ~~~~~~~~~~~~~
+!!! error TS1471: Module './index.mjs' cannot be imported using this construct. The specifier only resolves to an es module, which cannot be imported synchronously. Use dynamic import instead.
+    import * as m3 from "./index.cjs";
+    import * as m4 from "./subfolder/index.js";
+    import * as m5 from "./subfolder/index.mjs";
+                        ~~~~~~~~~~~~~~~~~~~~~~~
+!!! error TS1471: Module './subfolder/index.mjs' cannot be imported using this construct. The specifier only resolves to an es module, which cannot be imported synchronously. Use dynamic import instead.
+    import * as m6 from "./subfolder/index.cjs";
+    import * as m7 from "./subfolder2/index.js";
+    import * as m8 from "./subfolder2/index.mjs";
+                        ~~~~~~~~~~~~~~~~~~~~~~~~
+!!! error TS1471: Module './subfolder2/index.mjs' cannot be imported using this construct. The specifier only resolves to an es module, which cannot be imported synchronously. Use dynamic import instead.
+    import * as m9 from "./subfolder2/index.cjs";
+    import * as m10 from "./subfolder2/another/index.js";
+                         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+!!! error TS1471: Module './subfolder2/another/index.js' cannot be imported using this construct. The specifier only resolves to an es module, which cannot be imported synchronously. Use dynamic import instead.
+    import * as m11 from "./subfolder2/another/index.mjs";
+                         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+!!! error TS1471: Module './subfolder2/another/index.mjs' cannot be imported using this construct. The specifier only resolves to an es module, which cannot be imported synchronously. Use dynamic import instead.
+    import * as m12 from "./subfolder2/another/index.cjs";
+    void m1;
+    void m2;
+    void m3;
+    void m4;
+    void m5;
+    void m6;
+    void m7;
+    void m8;
+    void m9;
+    void m10;
+    void m11;
+    void m12;
+    // cjs format file
+    const x = 1;
+    export {x};
+==== tests/cases/conformance/node/index.ts (0 errors) ====
+    import * as m1 from "./index.js";
+    import * as m2 from "./index.mjs";
+    import * as m3 from "./index.cjs";
+    import * as m4 from "./subfolder/index.js";
+    import * as m5 from "./subfolder/index.mjs";
+    import * as m6 from "./subfolder/index.cjs";
+    import * as m7 from "./subfolder2/index.js";
+    import * as m8 from "./subfolder2/index.mjs";
+    import * as m9 from "./subfolder2/index.cjs";
+    import * as m10 from "./subfolder2/another/index.js";
+    import * as m11 from "./subfolder2/another/index.mjs";
+    import * as m12 from "./subfolder2/another/index.cjs";
+    void m1;
+    void m2;
+    void m3;
+    void m4;
+    void m5;
+    void m6;
+    void m7;
+    void m8;
+    void m9;
+    void m10;
+    void m11;
+    void m12;
+    // esm format file
+    const x = 1;
+    export {x};
+==== tests/cases/conformance/node/package.json (0 errors) ====
+    {
+        "name": "package",
+        "private": true,
+        "type": "module"
+    }
+==== tests/cases/conformance/node/subfolder/package.json (0 errors) ====
+    {
+        "type": "commonjs"
+    }
+==== tests/cases/conformance/node/subfolder2/package.json (0 errors) ====
+    {
+    }
+==== tests/cases/conformance/node/subfolder2/another/package.json (0 errors) ====
+    {
+        "type": "module"
+    }
\ No newline at end of file
diff --git a/tests/baselines/reference/nodeModules1(module=nodenext).js b/tests/baselines/reference/nodeModules1(module=nodenext).js
index 1acae5c9aab3b..fba5f41f193e3 100644
--- a/tests/baselines/reference/nodeModules1(module=nodenext).js
+++ b/tests/baselines/reference/nodeModules1(module=nodenext).js
@@ -4,15 +4,120 @@
 // cjs format file
 const x = 1;
 export {x};
+//// [index.cts]
+// cjs format file
+const x = 1;
+export {x};
+//// [index.mts]
+// esm format file
+const x = 1;
+export {x};
 //// [index.ts]
 // cjs format file
 const x = 1;
 export {x};
+//// [index.cts]
+// cjs format file
+const x = 1;
+export {x};
+//// [index.mts]
+// esm format file
+const x = 1;
+export {x};
 //// [index.ts]
 // esm format file
 const x = 1;
 export {x};
+//// [index.mts]
+// esm format file
+const x = 1;
+export {x};
+//// [index.cts]
+// cjs format file
+const x = 1;
+export {x};
+//// [index.mts]
+import * as m1 from "./index.js";
+import * as m2 from "./index.mjs";
+import * as m3 from "./index.cjs";
+import * as m4 from "./subfolder/index.js";
+import * as m5 from "./subfolder/index.mjs";
+import * as m6 from "./subfolder/index.cjs";
+import * as m7 from "./subfolder2/index.js";
+import * as m8 from "./subfolder2/index.mjs";
+import * as m9 from "./subfolder2/index.cjs";
+import * as m10 from "./subfolder2/another/index.js";
+import * as m11 from "./subfolder2/another/index.mjs";
+import * as m12 from "./subfolder2/another/index.cjs";
+void m1;
+void m2;
+void m3;
+void m4;
+void m5;
+void m6;
+void m7;
+void m8;
+void m9;
+void m10;
+void m11;
+void m12;
+// esm format file
+const x = 1;
+export {x};
+//// [index.cts]
+// ESM-format imports below should issue errors
+import * as m1 from "./index.js";
+import * as m2 from "./index.mjs";
+import * as m3 from "./index.cjs";
+import * as m4 from "./subfolder/index.js";
+import * as m5 from "./subfolder/index.mjs";
+import * as m6 from "./subfolder/index.cjs";
+import * as m7 from "./subfolder2/index.js";
+import * as m8 from "./subfolder2/index.mjs";
+import * as m9 from "./subfolder2/index.cjs";
+import * as m10 from "./subfolder2/another/index.js";
+import * as m11 from "./subfolder2/another/index.mjs";
+import * as m12 from "./subfolder2/another/index.cjs";
+void m1;
+void m2;
+void m3;
+void m4;
+void m5;
+void m6;
+void m7;
+void m8;
+void m9;
+void m10;
+void m11;
+void m12;
+// cjs format file
+const x = 1;
+export {x};
 //// [index.ts]
+import * as m1 from "./index.js";
+import * as m2 from "./index.mjs";
+import * as m3 from "./index.cjs";
+import * as m4 from "./subfolder/index.js";
+import * as m5 from "./subfolder/index.mjs";
+import * as m6 from "./subfolder/index.cjs";
+import * as m7 from "./subfolder2/index.js";
+import * as m8 from "./subfolder2/index.mjs";
+import * as m9 from "./subfolder2/index.cjs";
+import * as m10 from "./subfolder2/another/index.js";
+import * as m11 from "./subfolder2/another/index.mjs";
+import * as m12 from "./subfolder2/another/index.cjs";
+void m1;
+void m2;
+void m3;
+void m4;
+void m5;
+void m6;
+void m7;
+void m8;
+void m9;
+void m10;
+void m11;
+void m12;
 // esm format file
 const x = 1;
 export {x};
@@ -41,6 +146,17 @@ exports.x = void 0;
 // cjs format file
 const x = 1;
 exports.x = x;
+//// [index.cjs]
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.x = void 0;
+// cjs format file
+const x = 1;
+exports.x = x;
+//// [index.mjs]
+// esm format file
+const x = 1;
+export { x };
 //// [index.js]
 "use strict";
 Object.defineProperty(exports, "__esModule", { value: true });
@@ -48,25 +164,174 @@ exports.x = void 0;
 // cjs format file
 const x = 1;
 exports.x = x;
+//// [index.cjs]
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.x = void 0;
+// cjs format file
+const x = 1;
+exports.x = x;
+//// [index.mjs]
+// esm format file
+const x = 1;
+export { x };
 //// [index.js]
 // esm format file
 const x = 1;
 export { x };
+//// [index.mjs]
+// esm format file
+const x = 1;
+export { x };
+//// [index.cjs]
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.x = void 0;
+// cjs format file
+const x = 1;
+exports.x = x;
 //// [index.js]
+import * as m1 from "./index.js";
+import * as m2 from "./index.mjs";
+import * as m3 from "./index.cjs";
+import * as m4 from "./subfolder/index.js";
+import * as m5 from "./subfolder/index.mjs";
+import * as m6 from "./subfolder/index.cjs";
+import * as m7 from "./subfolder2/index.js";
+import * as m8 from "./subfolder2/index.mjs";
+import * as m9 from "./subfolder2/index.cjs";
+import * as m10 from "./subfolder2/another/index.js";
+import * as m11 from "./subfolder2/another/index.mjs";
+import * as m12 from "./subfolder2/another/index.cjs";
+void m1;
+void m2;
+void m3;
+void m4;
+void m5;
+void m6;
+void m7;
+void m8;
+void m9;
+void m10;
+void m11;
+void m12;
 // esm format file
 const x = 1;
 export { x };
+//// [index.mjs]
+import * as m1 from "./index.js";
+import * as m2 from "./index.mjs";
+import * as m3 from "./index.cjs";
+import * as m4 from "./subfolder/index.js";
+import * as m5 from "./subfolder/index.mjs";
+import * as m6 from "./subfolder/index.cjs";
+import * as m7 from "./subfolder2/index.js";
+import * as m8 from "./subfolder2/index.mjs";
+import * as m9 from "./subfolder2/index.cjs";
+import * as m10 from "./subfolder2/another/index.js";
+import * as m11 from "./subfolder2/another/index.mjs";
+import * as m12 from "./subfolder2/another/index.cjs";
+void m1;
+void m2;
+void m3;
+void m4;
+void m5;
+void m6;
+void m7;
+void m8;
+void m9;
+void m10;
+void m11;
+void m12;
+// esm format file
+const x = 1;
+export { x };
+//// [index.cjs]
+"use strict";
+var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
+    if (k2 === undefined) k2 = k;
+    Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
+}) : (function(o, m, k, k2) {
+    if (k2 === undefined) k2 = k;
+    o[k2] = m[k];
+}));
+var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
+    Object.defineProperty(o, "default", { enumerable: true, value: v });
+}) : function(o, v) {
+    o["default"] = v;
+});
+var __importStar = (this && this.__importStar) || function (mod) {
+    if (mod && mod.__esModule) return mod;
+    var result = {};
+    if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
+    __setModuleDefault(result, mod);
+    return result;
+};
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.x = void 0;
+// ESM-format imports below should issue errors
+const m1 = __importStar(require("./index.js"));
+const m2 = __importStar(require("./index.mjs"));
+const m3 = __importStar(require("./index.cjs"));
+const m4 = __importStar(require("./subfolder/index.js"));
+const m5 = __importStar(require("./subfolder/index.mjs"));
+const m6 = __importStar(require("./subfolder/index.cjs"));
+const m7 = __importStar(require("./subfolder2/index.js"));
+const m8 = __importStar(require("./subfolder2/index.mjs"));
+const m9 = __importStar(require("./subfolder2/index.cjs"));
+const m10 = __importStar(require("./subfolder2/another/index.js"));
+const m11 = __importStar(require("./subfolder2/another/index.mjs"));
+const m12 = __importStar(require("./subfolder2/another/index.cjs"));
+void m1;
+void m2;
+void m3;
+void m4;
+void m5;
+void m6;
+void m7;
+void m8;
+void m9;
+void m10;
+void m11;
+void m12;
+// cjs format file
+const x = 1;
+exports.x = x;
 
 
 //// [index.d.ts]
 declare const x = 1;
 export { x };
+//// [index.d.cts]
+declare const x = 1;
+export { x };
+//// [index.d.mts]
+declare const x = 1;
+export { x };
 //// [index.d.ts]
 declare const x = 1;
 export { x };
+//// [index.d.cts]
+declare const x = 1;
+export { x };
+//// [index.d.mts]
+declare const x = 1;
+export { x };
 //// [index.d.ts]
 declare const x = 1;
 export { x };
+//// [index.d.mts]
+declare const x = 1;
+export { x };
+//// [index.d.cts]
+declare const x = 1;
+export { x };
 //// [index.d.ts]
 declare const x = 1;
 export { x };
+//// [index.d.mts]
+declare const x = 1;
+export { x };
+//// [index.d.cts]
+declare const x = 1;
+export { x };
diff --git a/tests/baselines/reference/nodeModules1(module=nodenext).symbols b/tests/baselines/reference/nodeModules1(module=nodenext).symbols
index e1653429c87db..b8caa52c8cfa0 100644
--- a/tests/baselines/reference/nodeModules1(module=nodenext).symbols
+++ b/tests/baselines/reference/nodeModules1(module=nodenext).symbols
@@ -6,6 +6,22 @@ const x = 1;
 export {x};
 >x : Symbol(x, Decl(index.ts, 2, 8))
 
+=== tests/cases/conformance/node/subfolder/index.cts ===
+// cjs format file
+const x = 1;
+>x : Symbol(x, Decl(index.cts, 1, 5))
+
+export {x};
+>x : Symbol(x, Decl(index.cts, 2, 8))
+
+=== tests/cases/conformance/node/subfolder/index.mts ===
+// esm format file
+const x = 1;
+>x : Symbol(x, Decl(index.mts, 1, 5))
+
+export {x};
+>x : Symbol(x, Decl(index.mts, 2, 8))
+
 === tests/cases/conformance/node/subfolder2/index.ts ===
 // cjs format file
 const x = 1;
@@ -14,6 +30,22 @@ const x = 1;
 export {x};
 >x : Symbol(x, Decl(index.ts, 2, 8))
 
+=== tests/cases/conformance/node/subfolder2/index.cts ===
+// cjs format file
+const x = 1;
+>x : Symbol(x, Decl(index.cts, 1, 5))
+
+export {x};
+>x : Symbol(x, Decl(index.cts, 2, 8))
+
+=== tests/cases/conformance/node/subfolder2/index.mts ===
+// esm format file
+const x = 1;
+>x : Symbol(x, Decl(index.mts, 1, 5))
+
+export {x};
+>x : Symbol(x, Decl(index.mts, 2, 8))
+
 === tests/cases/conformance/node/subfolder2/another/index.ts ===
 // esm format file
 const x = 1;
@@ -22,11 +54,260 @@ const x = 1;
 export {x};
 >x : Symbol(x, Decl(index.ts, 2, 8))
 
+=== tests/cases/conformance/node/subfolder2/another/index.mts ===
+// esm format file
+const x = 1;
+>x : Symbol(x, Decl(index.mts, 1, 5))
+
+export {x};
+>x : Symbol(x, Decl(index.mts, 2, 8))
+
+=== tests/cases/conformance/node/subfolder2/another/index.cts ===
+// cjs format file
+const x = 1;
+>x : Symbol(x, Decl(index.cts, 1, 5))
+
+export {x};
+>x : Symbol(x, Decl(index.cts, 2, 8))
+
+=== tests/cases/conformance/node/index.mts ===
+import * as m1 from "./index.js";
+>m1 : Symbol(m1, Decl(index.mts, 0, 6))
+
+import * as m2 from "./index.mjs";
+>m2 : Symbol(m2, Decl(index.mts, 1, 6))
+
+import * as m3 from "./index.cjs";
+>m3 : Symbol(m3, Decl(index.mts, 2, 6))
+
+import * as m4 from "./subfolder/index.js";
+>m4 : Symbol(m4, Decl(index.mts, 3, 6))
+
+import * as m5 from "./subfolder/index.mjs";
+>m5 : Symbol(m5, Decl(index.mts, 4, 6))
+
+import * as m6 from "./subfolder/index.cjs";
+>m6 : Symbol(m6, Decl(index.mts, 5, 6))
+
+import * as m7 from "./subfolder2/index.js";
+>m7 : Symbol(m7, Decl(index.mts, 6, 6))
+
+import * as m8 from "./subfolder2/index.mjs";
+>m8 : Symbol(m8, Decl(index.mts, 7, 6))
+
+import * as m9 from "./subfolder2/index.cjs";
+>m9 : Symbol(m9, Decl(index.mts, 8, 6))
+
+import * as m10 from "./subfolder2/another/index.js";
+>m10 : Symbol(m10, Decl(index.mts, 9, 6))
+
+import * as m11 from "./subfolder2/another/index.mjs";
+>m11 : Symbol(m11, Decl(index.mts, 10, 6))
+
+import * as m12 from "./subfolder2/another/index.cjs";
+>m12 : Symbol(m12, Decl(index.mts, 11, 6))
+
+void m1;
+>m1 : Symbol(m1, Decl(index.mts, 0, 6))
+
+void m2;
+>m2 : Symbol(m2, Decl(index.mts, 1, 6))
+
+void m3;
+>m3 : Symbol(m3, Decl(index.mts, 2, 6))
+
+void m4;
+>m4 : Symbol(m4, Decl(index.mts, 3, 6))
+
+void m5;
+>m5 : Symbol(m5, Decl(index.mts, 4, 6))
+
+void m6;
+>m6 : Symbol(m6, Decl(index.mts, 5, 6))
+
+void m7;
+>m7 : Symbol(m7, Decl(index.mts, 6, 6))
+
+void m8;
+>m8 : Symbol(m8, Decl(index.mts, 7, 6))
+
+void m9;
+>m9 : Symbol(m9, Decl(index.mts, 8, 6))
+
+void m10;
+>m10 : Symbol(m10, Decl(index.mts, 9, 6))
+
+void m11;
+>m11 : Symbol(m11, Decl(index.mts, 10, 6))
+
+void m12;
+>m12 : Symbol(m12, Decl(index.mts, 11, 6))
+
+// esm format file
+const x = 1;
+>x : Symbol(x, Decl(index.mts, 25, 5))
+
+export {x};
+>x : Symbol(m2.x, Decl(index.mts, 26, 8))
+
+=== tests/cases/conformance/node/index.cts ===
+// ESM-format imports below should issue errors
+import * as m1 from "./index.js";
+>m1 : Symbol(m1, Decl(index.cts, 1, 6))
+
+import * as m2 from "./index.mjs";
+>m2 : Symbol(m2, Decl(index.cts, 2, 6))
+
+import * as m3 from "./index.cjs";
+>m3 : Symbol(m3, Decl(index.cts, 3, 6))
+
+import * as m4 from "./subfolder/index.js";
+>m4 : Symbol(m4, Decl(index.cts, 4, 6))
+
+import * as m5 from "./subfolder/index.mjs";
+>m5 : Symbol(m5, Decl(index.cts, 5, 6))
+
+import * as m6 from "./subfolder/index.cjs";
+>m6 : Symbol(m6, Decl(index.cts, 6, 6))
+
+import * as m7 from "./subfolder2/index.js";
+>m7 : Symbol(m7, Decl(index.cts, 7, 6))
+
+import * as m8 from "./subfolder2/index.mjs";
+>m8 : Symbol(m8, Decl(index.cts, 8, 6))
+
+import * as m9 from "./subfolder2/index.cjs";
+>m9 : Symbol(m9, Decl(index.cts, 9, 6))
+
+import * as m10 from "./subfolder2/another/index.js";
+>m10 : Symbol(m10, Decl(index.cts, 10, 6))
+
+import * as m11 from "./subfolder2/another/index.mjs";
+>m11 : Symbol(m11, Decl(index.cts, 11, 6))
+
+import * as m12 from "./subfolder2/another/index.cjs";
+>m12 : Symbol(m12, Decl(index.cts, 12, 6))
+
+void m1;
+>m1 : Symbol(m1, Decl(index.cts, 1, 6))
+
+void m2;
+>m2 : Symbol(m2, Decl(index.cts, 2, 6))
+
+void m3;
+>m3 : Symbol(m3, Decl(index.cts, 3, 6))
+
+void m4;
+>m4 : Symbol(m4, Decl(index.cts, 4, 6))
+
+void m5;
+>m5 : Symbol(m5, Decl(index.cts, 5, 6))
+
+void m6;
+>m6 : Symbol(m6, Decl(index.cts, 6, 6))
+
+void m7;
+>m7 : Symbol(m7, Decl(index.cts, 7, 6))
+
+void m8;
+>m8 : Symbol(m8, Decl(index.cts, 8, 6))
+
+void m9;
+>m9 : Symbol(m9, Decl(index.cts, 9, 6))
+
+void m10;
+>m10 : Symbol(m10, Decl(index.cts, 10, 6))
+
+void m11;
+>m11 : Symbol(m11, Decl(index.cts, 11, 6))
+
+void m12;
+>m12 : Symbol(m12, Decl(index.cts, 12, 6))
+
+// cjs format file
+const x = 1;
+>x : Symbol(x, Decl(index.cts, 26, 5))
+
+export {x};
+>x : Symbol(m3.x, Decl(index.cts, 27, 8))
+
 === tests/cases/conformance/node/index.ts ===
+import * as m1 from "./index.js";
+>m1 : Symbol(m1, Decl(index.ts, 0, 6))
+
+import * as m2 from "./index.mjs";
+>m2 : Symbol(m2, Decl(index.ts, 1, 6))
+
+import * as m3 from "./index.cjs";
+>m3 : Symbol(m3, Decl(index.ts, 2, 6))
+
+import * as m4 from "./subfolder/index.js";
+>m4 : Symbol(m4, Decl(index.ts, 3, 6))
+
+import * as m5 from "./subfolder/index.mjs";
+>m5 : Symbol(m5, Decl(index.ts, 4, 6))
+
+import * as m6 from "./subfolder/index.cjs";
+>m6 : Symbol(m6, Decl(index.ts, 5, 6))
+
+import * as m7 from "./subfolder2/index.js";
+>m7 : Symbol(m7, Decl(index.ts, 6, 6))
+
+import * as m8 from "./subfolder2/index.mjs";
+>m8 : Symbol(m8, Decl(index.ts, 7, 6))
+
+import * as m9 from "./subfolder2/index.cjs";
+>m9 : Symbol(m9, Decl(index.ts, 8, 6))
+
+import * as m10 from "./subfolder2/another/index.js";
+>m10 : Symbol(m10, Decl(index.ts, 9, 6))
+
+import * as m11 from "./subfolder2/another/index.mjs";
+>m11 : Symbol(m11, Decl(index.ts, 10, 6))
+
+import * as m12 from "./subfolder2/another/index.cjs";
+>m12 : Symbol(m12, Decl(index.ts, 11, 6))
+
+void m1;
+>m1 : Symbol(m1, Decl(index.ts, 0, 6))
+
+void m2;
+>m2 : Symbol(m2, Decl(index.ts, 1, 6))
+
+void m3;
+>m3 : Symbol(m3, Decl(index.ts, 2, 6))
+
+void m4;
+>m4 : Symbol(m4, Decl(index.ts, 3, 6))
+
+void m5;
+>m5 : Symbol(m5, Decl(index.ts, 4, 6))
+
+void m6;
+>m6 : Symbol(m6, Decl(index.ts, 5, 6))
+
+void m7;
+>m7 : Symbol(m7, Decl(index.ts, 6, 6))
+
+void m8;
+>m8 : Symbol(m8, Decl(index.ts, 7, 6))
+
+void m9;
+>m9 : Symbol(m9, Decl(index.ts, 8, 6))
+
+void m10;
+>m10 : Symbol(m10, Decl(index.ts, 9, 6))
+
+void m11;
+>m11 : Symbol(m11, Decl(index.ts, 10, 6))
+
+void m12;
+>m12 : Symbol(m12, Decl(index.ts, 11, 6))
+
 // esm format file
 const x = 1;
->x : Symbol(x, Decl(index.ts, 1, 5))
+>x : Symbol(x, Decl(index.ts, 25, 5))
 
 export {x};
->x : Symbol(x, Decl(index.ts, 2, 8))
+>x : Symbol(m1.x, Decl(index.ts, 26, 8))
 
diff --git a/tests/baselines/reference/nodeModules1(module=nodenext).types b/tests/baselines/reference/nodeModules1(module=nodenext).types
index 1c479a5e7bd48..cf878a592d2e9 100644
--- a/tests/baselines/reference/nodeModules1(module=nodenext).types
+++ b/tests/baselines/reference/nodeModules1(module=nodenext).types
@@ -7,6 +7,24 @@ const x = 1;
 export {x};
 >x : 1
 
+=== tests/cases/conformance/node/subfolder/index.cts ===
+// cjs format file
+const x = 1;
+>x : 1
+>1 : 1
+
+export {x};
+>x : 1
+
+=== tests/cases/conformance/node/subfolder/index.mts ===
+// esm format file
+const x = 1;
+>x : 1
+>1 : 1
+
+export {x};
+>x : 1
+
 === tests/cases/conformance/node/subfolder2/index.ts ===
 // cjs format file
 const x = 1;
@@ -16,6 +34,24 @@ const x = 1;
 export {x};
 >x : 1
 
+=== tests/cases/conformance/node/subfolder2/index.cts ===
+// cjs format file
+const x = 1;
+>x : 1
+>1 : 1
+
+export {x};
+>x : 1
+
+=== tests/cases/conformance/node/subfolder2/index.mts ===
+// esm format file
+const x = 1;
+>x : 1
+>1 : 1
+
+export {x};
+>x : 1
+
 === tests/cases/conformance/node/subfolder2/another/index.ts ===
 // esm format file
 const x = 1;
@@ -25,7 +61,296 @@ const x = 1;
 export {x};
 >x : 1
 
+=== tests/cases/conformance/node/subfolder2/another/index.mts ===
+// esm format file
+const x = 1;
+>x : 1
+>1 : 1
+
+export {x};
+>x : 1
+
+=== tests/cases/conformance/node/subfolder2/another/index.cts ===
+// cjs format file
+const x = 1;
+>x : 1
+>1 : 1
+
+export {x};
+>x : 1
+
+=== tests/cases/conformance/node/index.mts ===
+import * as m1 from "./index.js";
+>m1 : typeof m1
+
+import * as m2 from "./index.mjs";
+>m2 : typeof m2
+
+import * as m3 from "./index.cjs";
+>m3 : typeof m3
+
+import * as m4 from "./subfolder/index.js";
+>m4 : typeof m4
+
+import * as m5 from "./subfolder/index.mjs";
+>m5 : typeof m5
+
+import * as m6 from "./subfolder/index.cjs";
+>m6 : typeof m6
+
+import * as m7 from "./subfolder2/index.js";
+>m7 : typeof m7
+
+import * as m8 from "./subfolder2/index.mjs";
+>m8 : typeof m8
+
+import * as m9 from "./subfolder2/index.cjs";
+>m9 : typeof m9
+
+import * as m10 from "./subfolder2/another/index.js";
+>m10 : typeof m10
+
+import * as m11 from "./subfolder2/another/index.mjs";
+>m11 : typeof m11
+
+import * as m12 from "./subfolder2/another/index.cjs";
+>m12 : typeof m12
+
+void m1;
+>void m1 : undefined
+>m1 : typeof m1
+
+void m2;
+>void m2 : undefined
+>m2 : typeof m2
+
+void m3;
+>void m3 : undefined
+>m3 : typeof m3
+
+void m4;
+>void m4 : undefined
+>m4 : typeof m4
+
+void m5;
+>void m5 : undefined
+>m5 : typeof m5
+
+void m6;
+>void m6 : undefined
+>m6 : typeof m6
+
+void m7;
+>void m7 : undefined
+>m7 : typeof m7
+
+void m8;
+>void m8 : undefined
+>m8 : typeof m8
+
+void m9;
+>void m9 : undefined
+>m9 : typeof m9
+
+void m10;
+>void m10 : undefined
+>m10 : typeof m10
+
+void m11;
+>void m11 : undefined
+>m11 : typeof m11
+
+void m12;
+>void m12 : undefined
+>m12 : typeof m12
+
+// esm format file
+const x = 1;
+>x : 1
+>1 : 1
+
+export {x};
+>x : 1
+
+=== tests/cases/conformance/node/index.cts ===
+// ESM-format imports below should issue errors
+import * as m1 from "./index.js";
+>m1 : typeof m1
+
+import * as m2 from "./index.mjs";
+>m2 : typeof m2
+
+import * as m3 from "./index.cjs";
+>m3 : typeof m3
+
+import * as m4 from "./subfolder/index.js";
+>m4 : typeof m4
+
+import * as m5 from "./subfolder/index.mjs";
+>m5 : typeof m5
+
+import * as m6 from "./subfolder/index.cjs";
+>m6 : typeof m6
+
+import * as m7 from "./subfolder2/index.js";
+>m7 : typeof m7
+
+import * as m8 from "./subfolder2/index.mjs";
+>m8 : typeof m8
+
+import * as m9 from "./subfolder2/index.cjs";
+>m9 : typeof m9
+
+import * as m10 from "./subfolder2/another/index.js";
+>m10 : typeof m10
+
+import * as m11 from "./subfolder2/another/index.mjs";
+>m11 : typeof m11
+
+import * as m12 from "./subfolder2/another/index.cjs";
+>m12 : typeof m12
+
+void m1;
+>void m1 : undefined
+>m1 : typeof m1
+
+void m2;
+>void m2 : undefined
+>m2 : typeof m2
+
+void m3;
+>void m3 : undefined
+>m3 : typeof m3
+
+void m4;
+>void m4 : undefined
+>m4 : typeof m4
+
+void m5;
+>void m5 : undefined
+>m5 : typeof m5
+
+void m6;
+>void m6 : undefined
+>m6 : typeof m6
+
+void m7;
+>void m7 : undefined
+>m7 : typeof m7
+
+void m8;
+>void m8 : undefined
+>m8 : typeof m8
+
+void m9;
+>void m9 : undefined
+>m9 : typeof m9
+
+void m10;
+>void m10 : undefined
+>m10 : typeof m10
+
+void m11;
+>void m11 : undefined
+>m11 : typeof m11
+
+void m12;
+>void m12 : undefined
+>m12 : typeof m12
+
+// cjs format file
+const x = 1;
+>x : 1
+>1 : 1
+
+export {x};
+>x : 1
+
 === tests/cases/conformance/node/index.ts ===
+import * as m1 from "./index.js";
+>m1 : typeof m1
+
+import * as m2 from "./index.mjs";
+>m2 : typeof m2
+
+import * as m3 from "./index.cjs";
+>m3 : typeof m3
+
+import * as m4 from "./subfolder/index.js";
+>m4 : typeof m4
+
+import * as m5 from "./subfolder/index.mjs";
+>m5 : typeof m5
+
+import * as m6 from "./subfolder/index.cjs";
+>m6 : typeof m6
+
+import * as m7 from "./subfolder2/index.js";
+>m7 : typeof m7
+
+import * as m8 from "./subfolder2/index.mjs";
+>m8 : typeof m8
+
+import * as m9 from "./subfolder2/index.cjs";
+>m9 : typeof m9
+
+import * as m10 from "./subfolder2/another/index.js";
+>m10 : typeof m10
+
+import * as m11 from "./subfolder2/another/index.mjs";
+>m11 : typeof m11
+
+import * as m12 from "./subfolder2/another/index.cjs";
+>m12 : typeof m12
+
+void m1;
+>void m1 : undefined
+>m1 : typeof m1
+
+void m2;
+>void m2 : undefined
+>m2 : typeof m2
+
+void m3;
+>void m3 : undefined
+>m3 : typeof m3
+
+void m4;
+>void m4 : undefined
+>m4 : typeof m4
+
+void m5;
+>void m5 : undefined
+>m5 : typeof m5
+
+void m6;
+>void m6 : undefined
+>m6 : typeof m6
+
+void m7;
+>void m7 : undefined
+>m7 : typeof m7
+
+void m8;
+>void m8 : undefined
+>m8 : typeof m8
+
+void m9;
+>void m9 : undefined
+>m9 : typeof m9
+
+void m10;
+>void m10 : undefined
+>m10 : typeof m10
+
+void m11;
+>void m11 : undefined
+>m11 : typeof m11
+
+void m12;
+>void m12 : undefined
+>m12 : typeof m12
+
 // esm format file
 const x = 1;
 >x : 1
diff --git a/tests/baselines/reference/nodeModulesAllowJs1(module=node12).errors.txt b/tests/baselines/reference/nodeModulesAllowJs1(module=node12).errors.txt
new file mode 100644
index 0000000000000..365b00a0e162f
--- /dev/null
+++ b/tests/baselines/reference/nodeModulesAllowJs1(module=node12).errors.txt
@@ -0,0 +1,158 @@
+tests/cases/conformance/node/allowJs/index.cjs(2,21): error TS1471: Module './index.js' cannot be imported using this construct. The specifier only resolves to an es module, which cannot be imported synchronously. Use dynamic import instead.
+tests/cases/conformance/node/allowJs/index.cjs(3,21): error TS1471: Module './index.mjs' cannot be imported using this construct. The specifier only resolves to an es module, which cannot be imported synchronously. Use dynamic import instead.
+tests/cases/conformance/node/allowJs/index.cjs(6,21): error TS1471: Module './subfolder/index.mjs' cannot be imported using this construct. The specifier only resolves to an es module, which cannot be imported synchronously. Use dynamic import instead.
+tests/cases/conformance/node/allowJs/index.cjs(9,21): error TS1471: Module './subfolder2/index.mjs' cannot be imported using this construct. The specifier only resolves to an es module, which cannot be imported synchronously. Use dynamic import instead.
+tests/cases/conformance/node/allowJs/index.cjs(11,22): error TS1471: Module './subfolder2/another/index.js' cannot be imported using this construct. The specifier only resolves to an es module, which cannot be imported synchronously. Use dynamic import instead.
+tests/cases/conformance/node/allowJs/index.cjs(12,22): error TS1471: Module './subfolder2/another/index.mjs' cannot be imported using this construct. The specifier only resolves to an es module, which cannot be imported synchronously. Use dynamic import instead.
+
+
+==== tests/cases/conformance/node/allowJs/subfolder/index.js (0 errors) ====
+    // cjs format file
+    const x = 1;
+    export {x};
+==== tests/cases/conformance/node/allowJs/subfolder/index.cjs (0 errors) ====
+    // cjs format file
+    const x = 1;
+    export {x};
+==== tests/cases/conformance/node/allowJs/subfolder/index.mjs (0 errors) ====
+    // esm format file
+    const x = 1;
+    export {x};
+==== tests/cases/conformance/node/allowJs/subfolder2/index.js (0 errors) ====
+    // cjs format file
+    const x = 1;
+    export {x};
+==== tests/cases/conformance/node/allowJs/subfolder2/index.cjs (0 errors) ====
+    // cjs format file
+    const x = 1;
+    export {x};
+==== tests/cases/conformance/node/allowJs/subfolder2/index.mjs (0 errors) ====
+    // esm format file
+    const x = 1;
+    export {x};
+==== tests/cases/conformance/node/allowJs/subfolder2/another/index.js (0 errors) ====
+    // esm format file
+    const x = 1;
+    export {x};
+==== tests/cases/conformance/node/allowJs/subfolder2/another/index.cjs (0 errors) ====
+    // cjs format file
+    const x = 1;
+    export {x};
+==== tests/cases/conformance/node/allowJs/subfolder2/another/index.mjs (0 errors) ====
+    // esm format file
+    const x = 1;
+    export {x};
+==== tests/cases/conformance/node/allowJs/index.js (0 errors) ====
+    import * as m1 from "./index.js";
+    import * as m2 from "./index.mjs";
+    import * as m3 from "./index.cjs";
+    import * as m4 from "./subfolder/index.js";
+    import * as m5 from "./subfolder/index.mjs";
+    import * as m6 from "./subfolder/index.cjs";
+    import * as m7 from "./subfolder2/index.js";
+    import * as m8 from "./subfolder2/index.mjs";
+    import * as m9 from "./subfolder2/index.cjs";
+    import * as m10 from "./subfolder2/another/index.js";
+    import * as m11 from "./subfolder2/another/index.mjs";
+    import * as m12 from "./subfolder2/another/index.cjs";
+    void m1;
+    void m2;
+    void m3;
+    void m4;
+    void m5;
+    void m6;
+    void m7;
+    void m8;
+    void m9;
+    void m10;
+    void m11;
+    void m12;
+    // esm format file
+    const x = 1;
+    export {x};
+==== tests/cases/conformance/node/allowJs/index.cjs (6 errors) ====
+    // ESM format imports below should error
+    import * as m1 from "./index.js";
+                        ~~~~~~~~~~~~
+!!! error TS1471: Module './index.js' cannot be imported using this construct. The specifier only resolves to an es module, which cannot be imported synchronously. Use dynamic import instead.
+    import * as m2 from "./index.mjs";
+                        ~~~~~~~~~~~~~
+!!! error TS1471: Module './index.mjs' cannot be imported using this construct. The specifier only resolves to an es module, which cannot be imported synchronously. Use dynamic import instead.
+    import * as m3 from "./index.cjs";
+    import * as m4 from "./subfolder/index.js";
+    import * as m5 from "./subfolder/index.mjs";
+                        ~~~~~~~~~~~~~~~~~~~~~~~
+!!! error TS1471: Module './subfolder/index.mjs' cannot be imported using this construct. The specifier only resolves to an es module, which cannot be imported synchronously. Use dynamic import instead.
+    import * as m6 from "./subfolder/index.cjs";
+    import * as m7 from "./subfolder2/index.js";
+    import * as m8 from "./subfolder2/index.mjs";
+                        ~~~~~~~~~~~~~~~~~~~~~~~~
+!!! error TS1471: Module './subfolder2/index.mjs' cannot be imported using this construct. The specifier only resolves to an es module, which cannot be imported synchronously. Use dynamic import instead.
+    import * as m9 from "./subfolder2/index.cjs";
+    import * as m10 from "./subfolder2/another/index.js";
+                         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+!!! error TS1471: Module './subfolder2/another/index.js' cannot be imported using this construct. The specifier only resolves to an es module, which cannot be imported synchronously. Use dynamic import instead.
+    import * as m11 from "./subfolder2/another/index.mjs";
+                         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+!!! error TS1471: Module './subfolder2/another/index.mjs' cannot be imported using this construct. The specifier only resolves to an es module, which cannot be imported synchronously. Use dynamic import instead.
+    import * as m12 from "./subfolder2/another/index.cjs";
+    void m1;
+    void m2;
+    void m3;
+    void m4;
+    void m5;
+    void m6;
+    void m7;
+    void m8;
+    void m9;
+    void m10;
+    void m11;
+    void m12;
+    // cjs format file
+    const x = 1;
+    export {x};
+==== tests/cases/conformance/node/allowJs/index.mjs (0 errors) ====
+    import * as m1 from "./index.js";
+    import * as m2 from "./index.mjs";
+    import * as m3 from "./index.cjs";
+    import * as m4 from "./subfolder/index.js";
+    import * as m5 from "./subfolder/index.mjs";
+    import * as m6 from "./subfolder/index.cjs";
+    import * as m7 from "./subfolder2/index.js";
+    import * as m8 from "./subfolder2/index.mjs";
+    import * as m9 from "./subfolder2/index.cjs";
+    import * as m10 from "./subfolder2/another/index.js";
+    import * as m11 from "./subfolder2/another/index.mjs";
+    import * as m12 from "./subfolder2/another/index.cjs";
+    void m1;
+    void m2;
+    void m3;
+    void m4;
+    void m5;
+    void m6;
+    void m7;
+    void m8;
+    void m9;
+    void m10;
+    void m11;
+    void m12;
+    // esm format file
+    const x = 1;
+    export {x};
+==== tests/cases/conformance/node/allowJs/package.json (0 errors) ====
+    {
+        "name": "package",
+        "private": true,
+        "type": "module"
+    }
+==== tests/cases/conformance/node/allowJs/subfolder/package.json (0 errors) ====
+    {
+        "type": "commonjs"
+    }
+==== tests/cases/conformance/node/allowJs/subfolder2/package.json (0 errors) ====
+    {
+    }
+==== tests/cases/conformance/node/allowJs/subfolder2/another/package.json (0 errors) ====
+    {
+        "type": "module"
+    }
\ No newline at end of file
diff --git a/tests/baselines/reference/nodeModulesAllowJs1(module=node12).js b/tests/baselines/reference/nodeModulesAllowJs1(module=node12).js
index 358104e5f6a62..0ec674cdd18b3 100644
--- a/tests/baselines/reference/nodeModulesAllowJs1(module=node12).js
+++ b/tests/baselines/reference/nodeModulesAllowJs1(module=node12).js
@@ -4,15 +4,120 @@
 // cjs format file
 const x = 1;
 export {x};
+//// [index.cjs]
+// cjs format file
+const x = 1;
+export {x};
+//// [index.mjs]
+// esm format file
+const x = 1;
+export {x};
 //// [index.js]
 // cjs format file
 const x = 1;
 export {x};
+//// [index.cjs]
+// cjs format file
+const x = 1;
+export {x};
+//// [index.mjs]
+// esm format file
+const x = 1;
+export {x};
 //// [index.js]
 // esm format file
 const x = 1;
 export {x};
+//// [index.cjs]
+// cjs format file
+const x = 1;
+export {x};
+//// [index.mjs]
+// esm format file
+const x = 1;
+export {x};
 //// [index.js]
+import * as m1 from "./index.js";
+import * as m2 from "./index.mjs";
+import * as m3 from "./index.cjs";
+import * as m4 from "./subfolder/index.js";
+import * as m5 from "./subfolder/index.mjs";
+import * as m6 from "./subfolder/index.cjs";
+import * as m7 from "./subfolder2/index.js";
+import * as m8 from "./subfolder2/index.mjs";
+import * as m9 from "./subfolder2/index.cjs";
+import * as m10 from "./subfolder2/another/index.js";
+import * as m11 from "./subfolder2/another/index.mjs";
+import * as m12 from "./subfolder2/another/index.cjs";
+void m1;
+void m2;
+void m3;
+void m4;
+void m5;
+void m6;
+void m7;
+void m8;
+void m9;
+void m10;
+void m11;
+void m12;
+// esm format file
+const x = 1;
+export {x};
+//// [index.cjs]
+// ESM format imports below should error
+import * as m1 from "./index.js";
+import * as m2 from "./index.mjs";
+import * as m3 from "./index.cjs";
+import * as m4 from "./subfolder/index.js";
+import * as m5 from "./subfolder/index.mjs";
+import * as m6 from "./subfolder/index.cjs";
+import * as m7 from "./subfolder2/index.js";
+import * as m8 from "./subfolder2/index.mjs";
+import * as m9 from "./subfolder2/index.cjs";
+import * as m10 from "./subfolder2/another/index.js";
+import * as m11 from "./subfolder2/another/index.mjs";
+import * as m12 from "./subfolder2/another/index.cjs";
+void m1;
+void m2;
+void m3;
+void m4;
+void m5;
+void m6;
+void m7;
+void m8;
+void m9;
+void m10;
+void m11;
+void m12;
+// cjs format file
+const x = 1;
+export {x};
+//// [index.mjs]
+import * as m1 from "./index.js";
+import * as m2 from "./index.mjs";
+import * as m3 from "./index.cjs";
+import * as m4 from "./subfolder/index.js";
+import * as m5 from "./subfolder/index.mjs";
+import * as m6 from "./subfolder/index.cjs";
+import * as m7 from "./subfolder2/index.js";
+import * as m8 from "./subfolder2/index.mjs";
+import * as m9 from "./subfolder2/index.cjs";
+import * as m10 from "./subfolder2/another/index.js";
+import * as m11 from "./subfolder2/another/index.mjs";
+import * as m12 from "./subfolder2/another/index.cjs";
+void m1;
+void m2;
+void m3;
+void m4;
+void m5;
+void m6;
+void m7;
+void m8;
+void m9;
+void m10;
+void m11;
+void m12;
 // esm format file
 const x = 1;
 export {x};
@@ -41,6 +146,17 @@ exports.x = void 0;
 // cjs format file
 const x = 1;
 exports.x = x;
+//// [index.cjs]
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.x = void 0;
+// cjs format file
+const x = 1;
+exports.x = x;
+//// [index.mjs]
+// esm format file
+const x = 1;
+export { x };
 //// [index.js]
 "use strict";
 Object.defineProperty(exports, "__esModule", { value: true });
@@ -48,11 +164,136 @@ exports.x = void 0;
 // cjs format file
 const x = 1;
 exports.x = x;
+//// [index.cjs]
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.x = void 0;
+// cjs format file
+const x = 1;
+exports.x = x;
+//// [index.mjs]
+// esm format file
+const x = 1;
+export { x };
 //// [index.js]
 // esm format file
 const x = 1;
 export { x };
+//// [index.cjs]
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.x = void 0;
+// cjs format file
+const x = 1;
+exports.x = x;
+//// [index.mjs]
+// esm format file
+const x = 1;
+export { x };
+//// [index.cjs]
+"use strict";
+var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
+    if (k2 === undefined) k2 = k;
+    Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
+}) : (function(o, m, k, k2) {
+    if (k2 === undefined) k2 = k;
+    o[k2] = m[k];
+}));
+var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
+    Object.defineProperty(o, "default", { enumerable: true, value: v });
+}) : function(o, v) {
+    o["default"] = v;
+});
+var __importStar = (this && this.__importStar) || function (mod) {
+    if (mod && mod.__esModule) return mod;
+    var result = {};
+    if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
+    __setModuleDefault(result, mod);
+    return result;
+};
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.x = void 0;
+// ESM format imports below should error
+const m1 = __importStar(require("./index.js"));
+const m2 = __importStar(require("./index.mjs"));
+const m3 = __importStar(require("./index.cjs"));
+const m4 = __importStar(require("./subfolder/index.js"));
+const m5 = __importStar(require("./subfolder/index.mjs"));
+const m6 = __importStar(require("./subfolder/index.cjs"));
+const m7 = __importStar(require("./subfolder2/index.js"));
+const m8 = __importStar(require("./subfolder2/index.mjs"));
+const m9 = __importStar(require("./subfolder2/index.cjs"));
+const m10 = __importStar(require("./subfolder2/another/index.js"));
+const m11 = __importStar(require("./subfolder2/another/index.mjs"));
+const m12 = __importStar(require("./subfolder2/another/index.cjs"));
+void m1;
+void m2;
+void m3;
+void m4;
+void m5;
+void m6;
+void m7;
+void m8;
+void m9;
+void m10;
+void m11;
+void m12;
+// cjs format file
+const x = 1;
+exports.x = x;
+//// [index.mjs]
+import * as m1 from "./index.js";
+import * as m2 from "./index.mjs";
+import * as m3 from "./index.cjs";
+import * as m4 from "./subfolder/index.js";
+import * as m5 from "./subfolder/index.mjs";
+import * as m6 from "./subfolder/index.cjs";
+import * as m7 from "./subfolder2/index.js";
+import * as m8 from "./subfolder2/index.mjs";
+import * as m9 from "./subfolder2/index.cjs";
+import * as m10 from "./subfolder2/another/index.js";
+import * as m11 from "./subfolder2/another/index.mjs";
+import * as m12 from "./subfolder2/another/index.cjs";
+void m1;
+void m2;
+void m3;
+void m4;
+void m5;
+void m6;
+void m7;
+void m8;
+void m9;
+void m10;
+void m11;
+void m12;
+// esm format file
+const x = 1;
+export { x };
 //// [index.js]
+import * as m1 from "./index.js";
+import * as m2 from "./index.mjs";
+import * as m3 from "./index.cjs";
+import * as m4 from "./subfolder/index.js";
+import * as m5 from "./subfolder/index.mjs";
+import * as m6 from "./subfolder/index.cjs";
+import * as m7 from "./subfolder2/index.js";
+import * as m8 from "./subfolder2/index.mjs";
+import * as m9 from "./subfolder2/index.cjs";
+import * as m10 from "./subfolder2/another/index.js";
+import * as m11 from "./subfolder2/another/index.mjs";
+import * as m12 from "./subfolder2/another/index.cjs";
+void m1;
+void m2;
+void m3;
+void m4;
+void m5;
+void m6;
+void m7;
+void m8;
+void m9;
+void m10;
+void m11;
+void m12;
 // esm format file
 const x = 1;
 export { x };
@@ -60,9 +301,33 @@ export { x };
 
 //// [index.d.ts]
 export const x: 1;
+//// [index.d.cts]
+declare const x = 1;
+export { x };
+//// [index.d.mts]
+declare const x = 1;
+export { x };
 //// [index.d.ts]
 export const x: 1;
+//// [index.d.cts]
+declare const x = 1;
+export { x };
+//// [index.d.mts]
+declare const x = 1;
+export { x };
 //// [index.d.ts]
 export const x: 1;
+//// [index.d.cts]
+declare const x = 1;
+export { x };
+//// [index.d.mts]
+declare const x = 1;
+export { x };
+//// [index.d.cts]
+declare const x = 1;
+export { x };
+//// [index.d.mts]
+declare const x = 1;
+export { x };
 //// [index.d.ts]
 export const x: 1;
diff --git a/tests/baselines/reference/nodeModulesAllowJs1(module=node12).symbols b/tests/baselines/reference/nodeModulesAllowJs1(module=node12).symbols
index 99bfb2a40ff73..90c86e3a1be64 100644
--- a/tests/baselines/reference/nodeModulesAllowJs1(module=node12).symbols
+++ b/tests/baselines/reference/nodeModulesAllowJs1(module=node12).symbols
@@ -6,6 +6,22 @@ const x = 1;
 export {x};
 >x : Symbol(x, Decl(index.js, 2, 8))
 
+=== tests/cases/conformance/node/allowJs/subfolder/index.cjs ===
+// cjs format file
+const x = 1;
+>x : Symbol(x, Decl(index.cjs, 1, 5))
+
+export {x};
+>x : Symbol(x, Decl(index.cjs, 2, 8))
+
+=== tests/cases/conformance/node/allowJs/subfolder/index.mjs ===
+// esm format file
+const x = 1;
+>x : Symbol(x, Decl(index.mjs, 1, 5))
+
+export {x};
+>x : Symbol(x, Decl(index.mjs, 2, 8))
+
 === tests/cases/conformance/node/allowJs/subfolder2/index.js ===
 // cjs format file
 const x = 1;
@@ -14,6 +30,22 @@ const x = 1;
 export {x};
 >x : Symbol(x, Decl(index.js, 2, 8))
 
+=== tests/cases/conformance/node/allowJs/subfolder2/index.cjs ===
+// cjs format file
+const x = 1;
+>x : Symbol(x, Decl(index.cjs, 1, 5))
+
+export {x};
+>x : Symbol(x, Decl(index.cjs, 2, 8))
+
+=== tests/cases/conformance/node/allowJs/subfolder2/index.mjs ===
+// esm format file
+const x = 1;
+>x : Symbol(x, Decl(index.mjs, 1, 5))
+
+export {x};
+>x : Symbol(x, Decl(index.mjs, 2, 8))
+
 === tests/cases/conformance/node/allowJs/subfolder2/another/index.js ===
 // esm format file
 const x = 1;
@@ -22,11 +54,260 @@ const x = 1;
 export {x};
 >x : Symbol(x, Decl(index.js, 2, 8))
 
+=== tests/cases/conformance/node/allowJs/subfolder2/another/index.cjs ===
+// cjs format file
+const x = 1;
+>x : Symbol(x, Decl(index.cjs, 1, 5))
+
+export {x};
+>x : Symbol(x, Decl(index.cjs, 2, 8))
+
+=== tests/cases/conformance/node/allowJs/subfolder2/another/index.mjs ===
+// esm format file
+const x = 1;
+>x : Symbol(x, Decl(index.mjs, 1, 5))
+
+export {x};
+>x : Symbol(x, Decl(index.mjs, 2, 8))
+
 === tests/cases/conformance/node/allowJs/index.js ===
+import * as m1 from "./index.js";
+>m1 : Symbol(m1, Decl(index.js, 0, 6))
+
+import * as m2 from "./index.mjs";
+>m2 : Symbol(m2, Decl(index.js, 1, 6))
+
+import * as m3 from "./index.cjs";
+>m3 : Symbol(m3, Decl(index.js, 2, 6))
+
+import * as m4 from "./subfolder/index.js";
+>m4 : Symbol(m4, Decl(index.js, 3, 6))
+
+import * as m5 from "./subfolder/index.mjs";
+>m5 : Symbol(m5, Decl(index.js, 4, 6))
+
+import * as m6 from "./subfolder/index.cjs";
+>m6 : Symbol(m6, Decl(index.js, 5, 6))
+
+import * as m7 from "./subfolder2/index.js";
+>m7 : Symbol(m7, Decl(index.js, 6, 6))
+
+import * as m8 from "./subfolder2/index.mjs";
+>m8 : Symbol(m8, Decl(index.js, 7, 6))
+
+import * as m9 from "./subfolder2/index.cjs";
+>m9 : Symbol(m9, Decl(index.js, 8, 6))
+
+import * as m10 from "./subfolder2/another/index.js";
+>m10 : Symbol(m10, Decl(index.js, 9, 6))
+
+import * as m11 from "./subfolder2/another/index.mjs";
+>m11 : Symbol(m11, Decl(index.js, 10, 6))
+
+import * as m12 from "./subfolder2/another/index.cjs";
+>m12 : Symbol(m12, Decl(index.js, 11, 6))
+
+void m1;
+>m1 : Symbol(m1, Decl(index.js, 0, 6))
+
+void m2;
+>m2 : Symbol(m2, Decl(index.js, 1, 6))
+
+void m3;
+>m3 : Symbol(m3, Decl(index.js, 2, 6))
+
+void m4;
+>m4 : Symbol(m4, Decl(index.js, 3, 6))
+
+void m5;
+>m5 : Symbol(m5, Decl(index.js, 4, 6))
+
+void m6;
+>m6 : Symbol(m6, Decl(index.js, 5, 6))
+
+void m7;
+>m7 : Symbol(m7, Decl(index.js, 6, 6))
+
+void m8;
+>m8 : Symbol(m8, Decl(index.js, 7, 6))
+
+void m9;
+>m9 : Symbol(m9, Decl(index.js, 8, 6))
+
+void m10;
+>m10 : Symbol(m10, Decl(index.js, 9, 6))
+
+void m11;
+>m11 : Symbol(m11, Decl(index.js, 10, 6))
+
+void m12;
+>m12 : Symbol(m12, Decl(index.js, 11, 6))
+
 // esm format file
 const x = 1;
->x : Symbol(x, Decl(index.js, 1, 5))
+>x : Symbol(x, Decl(index.js, 25, 5))
 
 export {x};
->x : Symbol(x, Decl(index.js, 2, 8))
+>x : Symbol(m1.x, Decl(index.js, 26, 8))
+
+=== tests/cases/conformance/node/allowJs/index.cjs ===
+// ESM format imports below should error
+import * as m1 from "./index.js";
+>m1 : Symbol(m1, Decl(index.cjs, 1, 6))
+
+import * as m2 from "./index.mjs";
+>m2 : Symbol(m2, Decl(index.cjs, 2, 6))
+
+import * as m3 from "./index.cjs";
+>m3 : Symbol(m3, Decl(index.cjs, 3, 6))
+
+import * as m4 from "./subfolder/index.js";
+>m4 : Symbol(m4, Decl(index.cjs, 4, 6))
+
+import * as m5 from "./subfolder/index.mjs";
+>m5 : Symbol(m5, Decl(index.cjs, 5, 6))
+
+import * as m6 from "./subfolder/index.cjs";
+>m6 : Symbol(m6, Decl(index.cjs, 6, 6))
+
+import * as m7 from "./subfolder2/index.js";
+>m7 : Symbol(m7, Decl(index.cjs, 7, 6))
+
+import * as m8 from "./subfolder2/index.mjs";
+>m8 : Symbol(m8, Decl(index.cjs, 8, 6))
+
+import * as m9 from "./subfolder2/index.cjs";
+>m9 : Symbol(m9, Decl(index.cjs, 9, 6))
+
+import * as m10 from "./subfolder2/another/index.js";
+>m10 : Symbol(m10, Decl(index.cjs, 10, 6))
+
+import * as m11 from "./subfolder2/another/index.mjs";
+>m11 : Symbol(m11, Decl(index.cjs, 11, 6))
+
+import * as m12 from "./subfolder2/another/index.cjs";
+>m12 : Symbol(m12, Decl(index.cjs, 12, 6))
+
+void m1;
+>m1 : Symbol(m1, Decl(index.cjs, 1, 6))
+
+void m2;
+>m2 : Symbol(m2, Decl(index.cjs, 2, 6))
+
+void m3;
+>m3 : Symbol(m3, Decl(index.cjs, 3, 6))
+
+void m4;
+>m4 : Symbol(m4, Decl(index.cjs, 4, 6))
+
+void m5;
+>m5 : Symbol(m5, Decl(index.cjs, 5, 6))
+
+void m6;
+>m6 : Symbol(m6, Decl(index.cjs, 6, 6))
+
+void m7;
+>m7 : Symbol(m7, Decl(index.cjs, 7, 6))
+
+void m8;
+>m8 : Symbol(m8, Decl(index.cjs, 8, 6))
+
+void m9;
+>m9 : Symbol(m9, Decl(index.cjs, 9, 6))
+
+void m10;
+>m10 : Symbol(m10, Decl(index.cjs, 10, 6))
+
+void m11;
+>m11 : Symbol(m11, Decl(index.cjs, 11, 6))
+
+void m12;
+>m12 : Symbol(m12, Decl(index.cjs, 12, 6))
+
+// cjs format file
+const x = 1;
+>x : Symbol(x, Decl(index.cjs, 26, 5))
+
+export {x};
+>x : Symbol(m3.x, Decl(index.cjs, 27, 8))
+
+=== tests/cases/conformance/node/allowJs/index.mjs ===
+import * as m1 from "./index.js";
+>m1 : Symbol(m1, Decl(index.mjs, 0, 6))
+
+import * as m2 from "./index.mjs";
+>m2 : Symbol(m2, Decl(index.mjs, 1, 6))
+
+import * as m3 from "./index.cjs";
+>m3 : Symbol(m3, Decl(index.mjs, 2, 6))
+
+import * as m4 from "./subfolder/index.js";
+>m4 : Symbol(m4, Decl(index.mjs, 3, 6))
+
+import * as m5 from "./subfolder/index.mjs";
+>m5 : Symbol(m5, Decl(index.mjs, 4, 6))
+
+import * as m6 from "./subfolder/index.cjs";
+>m6 : Symbol(m6, Decl(index.mjs, 5, 6))
+
+import * as m7 from "./subfolder2/index.js";
+>m7 : Symbol(m7, Decl(index.mjs, 6, 6))
+
+import * as m8 from "./subfolder2/index.mjs";
+>m8 : Symbol(m8, Decl(index.mjs, 7, 6))
+
+import * as m9 from "./subfolder2/index.cjs";
+>m9 : Symbol(m9, Decl(index.mjs, 8, 6))
+
+import * as m10 from "./subfolder2/another/index.js";
+>m10 : Symbol(m10, Decl(index.mjs, 9, 6))
+
+import * as m11 from "./subfolder2/another/index.mjs";
+>m11 : Symbol(m11, Decl(index.mjs, 10, 6))
+
+import * as m12 from "./subfolder2/another/index.cjs";
+>m12 : Symbol(m12, Decl(index.mjs, 11, 6))
+
+void m1;
+>m1 : Symbol(m1, Decl(index.mjs, 0, 6))
+
+void m2;
+>m2 : Symbol(m2, Decl(index.mjs, 1, 6))
+
+void m3;
+>m3 : Symbol(m3, Decl(index.mjs, 2, 6))
+
+void m4;
+>m4 : Symbol(m4, Decl(index.mjs, 3, 6))
+
+void m5;
+>m5 : Symbol(m5, Decl(index.mjs, 4, 6))
+
+void m6;
+>m6 : Symbol(m6, Decl(index.mjs, 5, 6))
+
+void m7;
+>m7 : Symbol(m7, Decl(index.mjs, 6, 6))
+
+void m8;
+>m8 : Symbol(m8, Decl(index.mjs, 7, 6))
+
+void m9;
+>m9 : Symbol(m9, Decl(index.mjs, 8, 6))
+
+void m10;
+>m10 : Symbol(m10, Decl(index.mjs, 9, 6))
+
+void m11;
+>m11 : Symbol(m11, Decl(index.mjs, 10, 6))
+
+void m12;
+>m12 : Symbol(m12, Decl(index.mjs, 11, 6))
+
+// esm format file
+const x = 1;
+>x : Symbol(x, Decl(index.mjs, 25, 5))
+
+export {x};
+>x : Symbol(m2.x, Decl(index.mjs, 26, 8))
 
diff --git a/tests/baselines/reference/nodeModulesAllowJs1(module=node12).types b/tests/baselines/reference/nodeModulesAllowJs1(module=node12).types
index bb0713313ec99..d0acce4132567 100644
--- a/tests/baselines/reference/nodeModulesAllowJs1(module=node12).types
+++ b/tests/baselines/reference/nodeModulesAllowJs1(module=node12).types
@@ -7,6 +7,24 @@ const x = 1;
 export {x};
 >x : 1
 
+=== tests/cases/conformance/node/allowJs/subfolder/index.cjs ===
+// cjs format file
+const x = 1;
+>x : 1
+>1 : 1
+
+export {x};
+>x : 1
+
+=== tests/cases/conformance/node/allowJs/subfolder/index.mjs ===
+// esm format file
+const x = 1;
+>x : 1
+>1 : 1
+
+export {x};
+>x : 1
+
 === tests/cases/conformance/node/allowJs/subfolder2/index.js ===
 // cjs format file
 const x = 1;
@@ -16,6 +34,24 @@ const x = 1;
 export {x};
 >x : 1
 
+=== tests/cases/conformance/node/allowJs/subfolder2/index.cjs ===
+// cjs format file
+const x = 1;
+>x : 1
+>1 : 1
+
+export {x};
+>x : 1
+
+=== tests/cases/conformance/node/allowJs/subfolder2/index.mjs ===
+// esm format file
+const x = 1;
+>x : 1
+>1 : 1
+
+export {x};
+>x : 1
+
 === tests/cases/conformance/node/allowJs/subfolder2/another/index.js ===
 // esm format file
 const x = 1;
@@ -25,7 +61,296 @@ const x = 1;
 export {x};
 >x : 1
 
+=== tests/cases/conformance/node/allowJs/subfolder2/another/index.cjs ===
+// cjs format file
+const x = 1;
+>x : 1
+>1 : 1
+
+export {x};
+>x : 1
+
+=== tests/cases/conformance/node/allowJs/subfolder2/another/index.mjs ===
+// esm format file
+const x = 1;
+>x : 1
+>1 : 1
+
+export {x};
+>x : 1
+
 === tests/cases/conformance/node/allowJs/index.js ===
+import * as m1 from "./index.js";
+>m1 : typeof m1
+
+import * as m2 from "./index.mjs";
+>m2 : typeof m2
+
+import * as m3 from "./index.cjs";
+>m3 : typeof m3
+
+import * as m4 from "./subfolder/index.js";
+>m4 : typeof m4
+
+import * as m5 from "./subfolder/index.mjs";
+>m5 : typeof m5
+
+import * as m6 from "./subfolder/index.cjs";
+>m6 : typeof m6
+
+import * as m7 from "./subfolder2/index.js";
+>m7 : typeof m7
+
+import * as m8 from "./subfolder2/index.mjs";
+>m8 : typeof m8
+
+import * as m9 from "./subfolder2/index.cjs";
+>m9 : typeof m9
+
+import * as m10 from "./subfolder2/another/index.js";
+>m10 : typeof m10
+
+import * as m11 from "./subfolder2/another/index.mjs";
+>m11 : typeof m11
+
+import * as m12 from "./subfolder2/another/index.cjs";
+>m12 : typeof m12
+
+void m1;
+>void m1 : undefined
+>m1 : typeof m1
+
+void m2;
+>void m2 : undefined
+>m2 : typeof m2
+
+void m3;
+>void m3 : undefined
+>m3 : typeof m3
+
+void m4;
+>void m4 : undefined
+>m4 : typeof m4
+
+void m5;
+>void m5 : undefined
+>m5 : typeof m5
+
+void m6;
+>void m6 : undefined
+>m6 : typeof m6
+
+void m7;
+>void m7 : undefined
+>m7 : typeof m7
+
+void m8;
+>void m8 : undefined
+>m8 : typeof m8
+
+void m9;
+>void m9 : undefined
+>m9 : typeof m9
+
+void m10;
+>void m10 : undefined
+>m10 : typeof m10
+
+void m11;
+>void m11 : undefined
+>m11 : typeof m11
+
+void m12;
+>void m12 : undefined
+>m12 : typeof m12
+
+// esm format file
+const x = 1;
+>x : 1
+>1 : 1
+
+export {x};
+>x : 1
+
+=== tests/cases/conformance/node/allowJs/index.cjs ===
+// ESM format imports below should error
+import * as m1 from "./index.js";
+>m1 : typeof m1
+
+import * as m2 from "./index.mjs";
+>m2 : typeof m2
+
+import * as m3 from "./index.cjs";
+>m3 : typeof m3
+
+import * as m4 from "./subfolder/index.js";
+>m4 : typeof m4
+
+import * as m5 from "./subfolder/index.mjs";
+>m5 : typeof m5
+
+import * as m6 from "./subfolder/index.cjs";
+>m6 : typeof m6
+
+import * as m7 from "./subfolder2/index.js";
+>m7 : typeof m7
+
+import * as m8 from "./subfolder2/index.mjs";
+>m8 : typeof m8
+
+import * as m9 from "./subfolder2/index.cjs";
+>m9 : typeof m9
+
+import * as m10 from "./subfolder2/another/index.js";
+>m10 : typeof m10
+
+import * as m11 from "./subfolder2/another/index.mjs";
+>m11 : typeof m11
+
+import * as m12 from "./subfolder2/another/index.cjs";
+>m12 : typeof m12
+
+void m1;
+>void m1 : undefined
+>m1 : typeof m1
+
+void m2;
+>void m2 : undefined
+>m2 : typeof m2
+
+void m3;
+>void m3 : undefined
+>m3 : typeof m3
+
+void m4;
+>void m4 : undefined
+>m4 : typeof m4
+
+void m5;
+>void m5 : undefined
+>m5 : typeof m5
+
+void m6;
+>void m6 : undefined
+>m6 : typeof m6
+
+void m7;
+>void m7 : undefined
+>m7 : typeof m7
+
+void m8;
+>void m8 : undefined
+>m8 : typeof m8
+
+void m9;
+>void m9 : undefined
+>m9 : typeof m9
+
+void m10;
+>void m10 : undefined
+>m10 : typeof m10
+
+void m11;
+>void m11 : undefined
+>m11 : typeof m11
+
+void m12;
+>void m12 : undefined
+>m12 : typeof m12
+
+// cjs format file
+const x = 1;
+>x : 1
+>1 : 1
+
+export {x};
+>x : 1
+
+=== tests/cases/conformance/node/allowJs/index.mjs ===
+import * as m1 from "./index.js";
+>m1 : typeof m1
+
+import * as m2 from "./index.mjs";
+>m2 : typeof m2
+
+import * as m3 from "./index.cjs";
+>m3 : typeof m3
+
+import * as m4 from "./subfolder/index.js";
+>m4 : typeof m4
+
+import * as m5 from "./subfolder/index.mjs";
+>m5 : typeof m5
+
+import * as m6 from "./subfolder/index.cjs";
+>m6 : typeof m6
+
+import * as m7 from "./subfolder2/index.js";
+>m7 : typeof m7
+
+import * as m8 from "./subfolder2/index.mjs";
+>m8 : typeof m8
+
+import * as m9 from "./subfolder2/index.cjs";
+>m9 : typeof m9
+
+import * as m10 from "./subfolder2/another/index.js";
+>m10 : typeof m10
+
+import * as m11 from "./subfolder2/another/index.mjs";
+>m11 : typeof m11
+
+import * as m12 from "./subfolder2/another/index.cjs";
+>m12 : typeof m12
+
+void m1;
+>void m1 : undefined
+>m1 : typeof m1
+
+void m2;
+>void m2 : undefined
+>m2 : typeof m2
+
+void m3;
+>void m3 : undefined
+>m3 : typeof m3
+
+void m4;
+>void m4 : undefined
+>m4 : typeof m4
+
+void m5;
+>void m5 : undefined
+>m5 : typeof m5
+
+void m6;
+>void m6 : undefined
+>m6 : typeof m6
+
+void m7;
+>void m7 : undefined
+>m7 : typeof m7
+
+void m8;
+>void m8 : undefined
+>m8 : typeof m8
+
+void m9;
+>void m9 : undefined
+>m9 : typeof m9
+
+void m10;
+>void m10 : undefined
+>m10 : typeof m10
+
+void m11;
+>void m11 : undefined
+>m11 : typeof m11
+
+void m12;
+>void m12 : undefined
+>m12 : typeof m12
+
 // esm format file
 const x = 1;
 >x : 1
diff --git a/tests/baselines/reference/nodeModulesAllowJs1(module=nodenext).errors.txt b/tests/baselines/reference/nodeModulesAllowJs1(module=nodenext).errors.txt
new file mode 100644
index 0000000000000..365b00a0e162f
--- /dev/null
+++ b/tests/baselines/reference/nodeModulesAllowJs1(module=nodenext).errors.txt
@@ -0,0 +1,158 @@
+tests/cases/conformance/node/allowJs/index.cjs(2,21): error TS1471: Module './index.js' cannot be imported using this construct. The specifier only resolves to an es module, which cannot be imported synchronously. Use dynamic import instead.
+tests/cases/conformance/node/allowJs/index.cjs(3,21): error TS1471: Module './index.mjs' cannot be imported using this construct. The specifier only resolves to an es module, which cannot be imported synchronously. Use dynamic import instead.
+tests/cases/conformance/node/allowJs/index.cjs(6,21): error TS1471: Module './subfolder/index.mjs' cannot be imported using this construct. The specifier only resolves to an es module, which cannot be imported synchronously. Use dynamic import instead.
+tests/cases/conformance/node/allowJs/index.cjs(9,21): error TS1471: Module './subfolder2/index.mjs' cannot be imported using this construct. The specifier only resolves to an es module, which cannot be imported synchronously. Use dynamic import instead.
+tests/cases/conformance/node/allowJs/index.cjs(11,22): error TS1471: Module './subfolder2/another/index.js' cannot be imported using this construct. The specifier only resolves to an es module, which cannot be imported synchronously. Use dynamic import instead.
+tests/cases/conformance/node/allowJs/index.cjs(12,22): error TS1471: Module './subfolder2/another/index.mjs' cannot be imported using this construct. The specifier only resolves to an es module, which cannot be imported synchronously. Use dynamic import instead.
+
+
+==== tests/cases/conformance/node/allowJs/subfolder/index.js (0 errors) ====
+    // cjs format file
+    const x = 1;
+    export {x};
+==== tests/cases/conformance/node/allowJs/subfolder/index.cjs (0 errors) ====
+    // cjs format file
+    const x = 1;
+    export {x};
+==== tests/cases/conformance/node/allowJs/subfolder/index.mjs (0 errors) ====
+    // esm format file
+    const x = 1;
+    export {x};
+==== tests/cases/conformance/node/allowJs/subfolder2/index.js (0 errors) ====
+    // cjs format file
+    const x = 1;
+    export {x};
+==== tests/cases/conformance/node/allowJs/subfolder2/index.cjs (0 errors) ====
+    // cjs format file
+    const x = 1;
+    export {x};
+==== tests/cases/conformance/node/allowJs/subfolder2/index.mjs (0 errors) ====
+    // esm format file
+    const x = 1;
+    export {x};
+==== tests/cases/conformance/node/allowJs/subfolder2/another/index.js (0 errors) ====
+    // esm format file
+    const x = 1;
+    export {x};
+==== tests/cases/conformance/node/allowJs/subfolder2/another/index.cjs (0 errors) ====
+    // cjs format file
+    const x = 1;
+    export {x};
+==== tests/cases/conformance/node/allowJs/subfolder2/another/index.mjs (0 errors) ====
+    // esm format file
+    const x = 1;
+    export {x};
+==== tests/cases/conformance/node/allowJs/index.js (0 errors) ====
+    import * as m1 from "./index.js";
+    import * as m2 from "./index.mjs";
+    import * as m3 from "./index.cjs";
+    import * as m4 from "./subfolder/index.js";
+    import * as m5 from "./subfolder/index.mjs";
+    import * as m6 from "./subfolder/index.cjs";
+    import * as m7 from "./subfolder2/index.js";
+    import * as m8 from "./subfolder2/index.mjs";
+    import * as m9 from "./subfolder2/index.cjs";
+    import * as m10 from "./subfolder2/another/index.js";
+    import * as m11 from "./subfolder2/another/index.mjs";
+    import * as m12 from "./subfolder2/another/index.cjs";
+    void m1;
+    void m2;
+    void m3;
+    void m4;
+    void m5;
+    void m6;
+    void m7;
+    void m8;
+    void m9;
+    void m10;
+    void m11;
+    void m12;
+    // esm format file
+    const x = 1;
+    export {x};
+==== tests/cases/conformance/node/allowJs/index.cjs (6 errors) ====
+    // ESM format imports below should error
+    import * as m1 from "./index.js";
+                        ~~~~~~~~~~~~
+!!! error TS1471: Module './index.js' cannot be imported using this construct. The specifier only resolves to an es module, which cannot be imported synchronously. Use dynamic import instead.
+    import * as m2 from "./index.mjs";
+                        ~~~~~~~~~~~~~
+!!! error TS1471: Module './index.mjs' cannot be imported using this construct. The specifier only resolves to an es module, which cannot be imported synchronously. Use dynamic import instead.
+    import * as m3 from "./index.cjs";
+    import * as m4 from "./subfolder/index.js";
+    import * as m5 from "./subfolder/index.mjs";
+                        ~~~~~~~~~~~~~~~~~~~~~~~
+!!! error TS1471: Module './subfolder/index.mjs' cannot be imported using this construct. The specifier only resolves to an es module, which cannot be imported synchronously. Use dynamic import instead.
+    import * as m6 from "./subfolder/index.cjs";
+    import * as m7 from "./subfolder2/index.js";
+    import * as m8 from "./subfolder2/index.mjs";
+                        ~~~~~~~~~~~~~~~~~~~~~~~~
+!!! error TS1471: Module './subfolder2/index.mjs' cannot be imported using this construct. The specifier only resolves to an es module, which cannot be imported synchronously. Use dynamic import instead.
+    import * as m9 from "./subfolder2/index.cjs";
+    import * as m10 from "./subfolder2/another/index.js";
+                         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+!!! error TS1471: Module './subfolder2/another/index.js' cannot be imported using this construct. The specifier only resolves to an es module, which cannot be imported synchronously. Use dynamic import instead.
+    import * as m11 from "./subfolder2/another/index.mjs";
+                         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+!!! error TS1471: Module './subfolder2/another/index.mjs' cannot be imported using this construct. The specifier only resolves to an es module, which cannot be imported synchronously. Use dynamic import instead.
+    import * as m12 from "./subfolder2/another/index.cjs";
+    void m1;
+    void m2;
+    void m3;
+    void m4;
+    void m5;
+    void m6;
+    void m7;
+    void m8;
+    void m9;
+    void m10;
+    void m11;
+    void m12;
+    // cjs format file
+    const x = 1;
+    export {x};
+==== tests/cases/conformance/node/allowJs/index.mjs (0 errors) ====
+    import * as m1 from "./index.js";
+    import * as m2 from "./index.mjs";
+    import * as m3 from "./index.cjs";
+    import * as m4 from "./subfolder/index.js";
+    import * as m5 from "./subfolder/index.mjs";
+    import * as m6 from "./subfolder/index.cjs";
+    import * as m7 from "./subfolder2/index.js";
+    import * as m8 from "./subfolder2/index.mjs";
+    import * as m9 from "./subfolder2/index.cjs";
+    import * as m10 from "./subfolder2/another/index.js";
+    import * as m11 from "./subfolder2/another/index.mjs";
+    import * as m12 from "./subfolder2/another/index.cjs";
+    void m1;
+    void m2;
+    void m3;
+    void m4;
+    void m5;
+    void m6;
+    void m7;
+    void m8;
+    void m9;
+    void m10;
+    void m11;
+    void m12;
+    // esm format file
+    const x = 1;
+    export {x};
+==== tests/cases/conformance/node/allowJs/package.json (0 errors) ====
+    {
+        "name": "package",
+        "private": true,
+        "type": "module"
+    }
+==== tests/cases/conformance/node/allowJs/subfolder/package.json (0 errors) ====
+    {
+        "type": "commonjs"
+    }
+==== tests/cases/conformance/node/allowJs/subfolder2/package.json (0 errors) ====
+    {
+    }
+==== tests/cases/conformance/node/allowJs/subfolder2/another/package.json (0 errors) ====
+    {
+        "type": "module"
+    }
\ No newline at end of file
diff --git a/tests/baselines/reference/nodeModulesAllowJs1(module=nodenext).js b/tests/baselines/reference/nodeModulesAllowJs1(module=nodenext).js
index 358104e5f6a62..0ec674cdd18b3 100644
--- a/tests/baselines/reference/nodeModulesAllowJs1(module=nodenext).js
+++ b/tests/baselines/reference/nodeModulesAllowJs1(module=nodenext).js
@@ -4,15 +4,120 @@
 // cjs format file
 const x = 1;
 export {x};
+//// [index.cjs]
+// cjs format file
+const x = 1;
+export {x};
+//// [index.mjs]
+// esm format file
+const x = 1;
+export {x};
 //// [index.js]
 // cjs format file
 const x = 1;
 export {x};
+//// [index.cjs]
+// cjs format file
+const x = 1;
+export {x};
+//// [index.mjs]
+// esm format file
+const x = 1;
+export {x};
 //// [index.js]
 // esm format file
 const x = 1;
 export {x};
+//// [index.cjs]
+// cjs format file
+const x = 1;
+export {x};
+//// [index.mjs]
+// esm format file
+const x = 1;
+export {x};
 //// [index.js]
+import * as m1 from "./index.js";
+import * as m2 from "./index.mjs";
+import * as m3 from "./index.cjs";
+import * as m4 from "./subfolder/index.js";
+import * as m5 from "./subfolder/index.mjs";
+import * as m6 from "./subfolder/index.cjs";
+import * as m7 from "./subfolder2/index.js";
+import * as m8 from "./subfolder2/index.mjs";
+import * as m9 from "./subfolder2/index.cjs";
+import * as m10 from "./subfolder2/another/index.js";
+import * as m11 from "./subfolder2/another/index.mjs";
+import * as m12 from "./subfolder2/another/index.cjs";
+void m1;
+void m2;
+void m3;
+void m4;
+void m5;
+void m6;
+void m7;
+void m8;
+void m9;
+void m10;
+void m11;
+void m12;
+// esm format file
+const x = 1;
+export {x};
+//// [index.cjs]
+// ESM format imports below should error
+import * as m1 from "./index.js";
+import * as m2 from "./index.mjs";
+import * as m3 from "./index.cjs";
+import * as m4 from "./subfolder/index.js";
+import * as m5 from "./subfolder/index.mjs";
+import * as m6 from "./subfolder/index.cjs";
+import * as m7 from "./subfolder2/index.js";
+import * as m8 from "./subfolder2/index.mjs";
+import * as m9 from "./subfolder2/index.cjs";
+import * as m10 from "./subfolder2/another/index.js";
+import * as m11 from "./subfolder2/another/index.mjs";
+import * as m12 from "./subfolder2/another/index.cjs";
+void m1;
+void m2;
+void m3;
+void m4;
+void m5;
+void m6;
+void m7;
+void m8;
+void m9;
+void m10;
+void m11;
+void m12;
+// cjs format file
+const x = 1;
+export {x};
+//// [index.mjs]
+import * as m1 from "./index.js";
+import * as m2 from "./index.mjs";
+import * as m3 from "./index.cjs";
+import * as m4 from "./subfolder/index.js";
+import * as m5 from "./subfolder/index.mjs";
+import * as m6 from "./subfolder/index.cjs";
+import * as m7 from "./subfolder2/index.js";
+import * as m8 from "./subfolder2/index.mjs";
+import * as m9 from "./subfolder2/index.cjs";
+import * as m10 from "./subfolder2/another/index.js";
+import * as m11 from "./subfolder2/another/index.mjs";
+import * as m12 from "./subfolder2/another/index.cjs";
+void m1;
+void m2;
+void m3;
+void m4;
+void m5;
+void m6;
+void m7;
+void m8;
+void m9;
+void m10;
+void m11;
+void m12;
 // esm format file
 const x = 1;
 export {x};
@@ -41,6 +146,17 @@ exports.x = void 0;
 // cjs format file
 const x = 1;
 exports.x = x;
+//// [index.cjs]
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.x = void 0;
+// cjs format file
+const x = 1;
+exports.x = x;
+//// [index.mjs]
+// esm format file
+const x = 1;
+export { x };
 //// [index.js]
 "use strict";
 Object.defineProperty(exports, "__esModule", { value: true });
@@ -48,11 +164,136 @@ exports.x = void 0;
 // cjs format file
 const x = 1;
 exports.x = x;
+//// [index.cjs]
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.x = void 0;
+// cjs format file
+const x = 1;
+exports.x = x;
+//// [index.mjs]
+// esm format file
+const x = 1;
+export { x };
 //// [index.js]
 // esm format file
 const x = 1;
 export { x };
+//// [index.cjs]
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.x = void 0;
+// cjs format file
+const x = 1;
+exports.x = x;
+//// [index.mjs]
+// esm format file
+const x = 1;
+export { x };
+//// [index.cjs]
+"use strict";
+var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
+    if (k2 === undefined) k2 = k;
+    Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
+}) : (function(o, m, k, k2) {
+    if (k2 === undefined) k2 = k;
+    o[k2] = m[k];
+}));
+var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
+    Object.defineProperty(o, "default", { enumerable: true, value: v });
+}) : function(o, v) {
+    o["default"] = v;
+});
+var __importStar = (this && this.__importStar) || function (mod) {
+    if (mod && mod.__esModule) return mod;
+    var result = {};
+    if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
+    __setModuleDefault(result, mod);
+    return result;
+};
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.x = void 0;
+// ESM format imports below should error
+const m1 = __importStar(require("./index.js"));
+const m2 = __importStar(require("./index.mjs"));
+const m3 = __importStar(require("./index.cjs"));
+const m4 = __importStar(require("./subfolder/index.js"));
+const m5 = __importStar(require("./subfolder/index.mjs"));
+const m6 = __importStar(require("./subfolder/index.cjs"));
+const m7 = __importStar(require("./subfolder2/index.js"));
+const m8 = __importStar(require("./subfolder2/index.mjs"));
+const m9 = __importStar(require("./subfolder2/index.cjs"));
+const m10 = __importStar(require("./subfolder2/another/index.js"));
+const m11 = __importStar(require("./subfolder2/another/index.mjs"));
+const m12 = __importStar(require("./subfolder2/another/index.cjs"));
+void m1;
+void m2;
+void m3;
+void m4;
+void m5;
+void m6;
+void m7;
+void m8;
+void m9;
+void m10;
+void m11;
+void m12;
+// cjs format file
+const x = 1;
+exports.x = x;
+//// [index.mjs]
+import * as m1 from "./index.js";
+import * as m2 from "./index.mjs";
+import * as m3 from "./index.cjs";
+import * as m4 from "./subfolder/index.js";
+import * as m5 from "./subfolder/index.mjs";
+import * as m6 from "./subfolder/index.cjs";
+import * as m7 from "./subfolder2/index.js";
+import * as m8 from "./subfolder2/index.mjs";
+import * as m9 from "./subfolder2/index.cjs";
+import * as m10 from "./subfolder2/another/index.js";
+import * as m11 from "./subfolder2/another/index.mjs";
+import * as m12 from "./subfolder2/another/index.cjs";
+void m1;
+void m2;
+void m3;
+void m4;
+void m5;
+void m6;
+void m7;
+void m8;
+void m9;
+void m10;
+void m11;
+void m12;
+// esm format file
+const x = 1;
+export { x };
 //// [index.js]
+import * as m1 from "./index.js";
+import * as m2 from "./index.mjs";
+import * as m3 from "./index.cjs";
+import * as m4 from "./subfolder/index.js";
+import * as m5 from "./subfolder/index.mjs";
+import * as m6 from "./subfolder/index.cjs";
+import * as m7 from "./subfolder2/index.js";
+import * as m8 from "./subfolder2/index.mjs";
+import * as m9 from "./subfolder2/index.cjs";
+import * as m10 from "./subfolder2/another/index.js";
+import * as m11 from "./subfolder2/another/index.mjs";
+import * as m12 from "./subfolder2/another/index.cjs";
+void m1;
+void m2;
+void m3;
+void m4;
+void m5;
+void m6;
+void m7;
+void m8;
+void m9;
+void m10;
+void m11;
+void m12;
 // esm format file
 const x = 1;
 export { x };
@@ -60,9 +301,33 @@ export { x };
 
 //// [index.d.ts]
 export const x: 1;
+//// [index.d.cts]
+declare const x = 1;
+export { x };
+//// [index.d.mts]
+declare const x = 1;
+export { x };
 //// [index.d.ts]
 export const x: 1;
+//// [index.d.cts]
+declare const x = 1;
+export { x };
+//// [index.d.mts]
+declare const x = 1;
+export { x };
 //// [index.d.ts]
 export const x: 1;
+//// [index.d.cts]
+declare const x = 1;
+export { x };
+//// [index.d.mts]
+declare const x = 1;
+export { x };
+//// [index.d.cts]
+declare const x = 1;
+export { x };
+//// [index.d.mts]
+declare const x = 1;
+export { x };
 //// [index.d.ts]
 export const x: 1;
diff --git a/tests/baselines/reference/nodeModulesAllowJs1(module=nodenext).symbols b/tests/baselines/reference/nodeModulesAllowJs1(module=nodenext).symbols
index 99bfb2a40ff73..90c86e3a1be64 100644
--- a/tests/baselines/reference/nodeModulesAllowJs1(module=nodenext).symbols
+++ b/tests/baselines/reference/nodeModulesAllowJs1(module=nodenext).symbols
@@ -6,6 +6,22 @@ const x = 1;
 export {x};
 >x : Symbol(x, Decl(index.js, 2, 8))
 
+=== tests/cases/conformance/node/allowJs/subfolder/index.cjs ===
+// cjs format file
+const x = 1;
+>x : Symbol(x, Decl(index.cjs, 1, 5))
+
+export {x};
+>x : Symbol(x, Decl(index.cjs, 2, 8))
+
+=== tests/cases/conformance/node/allowJs/subfolder/index.mjs ===
+// esm format file
+const x = 1;
+>x : Symbol(x, Decl(index.mjs, 1, 5))
+
+export {x};
+>x : Symbol(x, Decl(index.mjs, 2, 8))
+
 === tests/cases/conformance/node/allowJs/subfolder2/index.js ===
 // cjs format file
 const x = 1;
@@ -14,6 +30,22 @@ const x = 1;
 export {x};
 >x : Symbol(x, Decl(index.js, 2, 8))
 
+=== tests/cases/conformance/node/allowJs/subfolder2/index.cjs ===
+// cjs format file
+const x = 1;
+>x : Symbol(x, Decl(index.cjs, 1, 5))
+
+export {x};
+>x : Symbol(x, Decl(index.cjs, 2, 8))
+
+=== tests/cases/conformance/node/allowJs/subfolder2/index.mjs ===
+// esm format file
+const x = 1;
+>x : Symbol(x, Decl(index.mjs, 1, 5))
+
+export {x};
+>x : Symbol(x, Decl(index.mjs, 2, 8))
+
 === tests/cases/conformance/node/allowJs/subfolder2/another/index.js ===
 // esm format file
 const x = 1;
@@ -22,11 +54,260 @@ const x = 1;
 export {x};
 >x : Symbol(x, Decl(index.js, 2, 8))
 
+=== tests/cases/conformance/node/allowJs/subfolder2/another/index.cjs ===
+// cjs format file
+const x = 1;
+>x : Symbol(x, Decl(index.cjs, 1, 5))
+
+export {x};
+>x : Symbol(x, Decl(index.cjs, 2, 8))
+
+=== tests/cases/conformance/node/allowJs/subfolder2/another/index.mjs ===
+// esm format file
+const x = 1;
+>x : Symbol(x, Decl(index.mjs, 1, 5))
+
+export {x};
+>x : Symbol(x, Decl(index.mjs, 2, 8))
+
 === tests/cases/conformance/node/allowJs/index.js ===
+import * as m1 from "./index.js";
+>m1 : Symbol(m1, Decl(index.js, 0, 6))
+
+import * as m2 from "./index.mjs";
+>m2 : Symbol(m2, Decl(index.js, 1, 6))
+
+import * as m3 from "./index.cjs";
+>m3 : Symbol(m3, Decl(index.js, 2, 6))
+
+import * as m4 from "./subfolder/index.js";
+>m4 : Symbol(m4, Decl(index.js, 3, 6))
+
+import * as m5 from "./subfolder/index.mjs";
+>m5 : Symbol(m5, Decl(index.js, 4, 6))
+
+import * as m6 from "./subfolder/index.cjs";
+>m6 : Symbol(m6, Decl(index.js, 5, 6))
+
+import * as m7 from "./subfolder2/index.js";
+>m7 : Symbol(m7, Decl(index.js, 6, 6))
+
+import * as m8 from "./subfolder2/index.mjs";
+>m8 : Symbol(m8, Decl(index.js, 7, 6))
+
+import * as m9 from "./subfolder2/index.cjs";
+>m9 : Symbol(m9, Decl(index.js, 8, 6))
+
+import * as m10 from "./subfolder2/another/index.js";
+>m10 : Symbol(m10, Decl(index.js, 9, 6))
+
+import * as m11 from "./subfolder2/another/index.mjs";
+>m11 : Symbol(m11, Decl(index.js, 10, 6))
+
+import * as m12 from "./subfolder2/another/index.cjs";
+>m12 : Symbol(m12, Decl(index.js, 11, 6))
+
+void m1;
+>m1 : Symbol(m1, Decl(index.js, 0, 6))
+
+void m2;
+>m2 : Symbol(m2, Decl(index.js, 1, 6))
+
+void m3;
+>m3 : Symbol(m3, Decl(index.js, 2, 6))
+
+void m4;
+>m4 : Symbol(m4, Decl(index.js, 3, 6))
+
+void m5;
+>m5 : Symbol(m5, Decl(index.js, 4, 6))
+
+void m6;
+>m6 : Symbol(m6, Decl(index.js, 5, 6))
+
+void m7;
+>m7 : Symbol(m7, Decl(index.js, 6, 6))
+
+void m8;
+>m8 : Symbol(m8, Decl(index.js, 7, 6))
+
+void m9;
+>m9 : Symbol(m9, Decl(index.js, 8, 6))
+
+void m10;
+>m10 : Symbol(m10, Decl(index.js, 9, 6))
+
+void m11;
+>m11 : Symbol(m11, Decl(index.js, 10, 6))
+
+void m12;
+>m12 : Symbol(m12, Decl(index.js, 11, 6))
+
 // esm format file
 const x = 1;
->x : Symbol(x, Decl(index.js, 1, 5))
+>x : Symbol(x, Decl(index.js, 25, 5))
 
 export {x};
->x : Symbol(x, Decl(index.js, 2, 8))
+>x : Symbol(m1.x, Decl(index.js, 26, 8))
+
+=== tests/cases/conformance/node/allowJs/index.cjs ===
+// ESM format imports below should error
+import * as m1 from "./index.js";
+>m1 : Symbol(m1, Decl(index.cjs, 1, 6))
+
+import * as m2 from "./index.mjs";
+>m2 : Symbol(m2, Decl(index.cjs, 2, 6))
+
+import * as m3 from "./index.cjs";
+>m3 : Symbol(m3, Decl(index.cjs, 3, 6))
+
+import * as m4 from "./subfolder/index.js";
+>m4 : Symbol(m4, Decl(index.cjs, 4, 6))
+
+import * as m5 from "./subfolder/index.mjs";
+>m5 : Symbol(m5, Decl(index.cjs, 5, 6))
+
+import * as m6 from "./subfolder/index.cjs";
+>m6 : Symbol(m6, Decl(index.cjs, 6, 6))
+
+import * as m7 from "./subfolder2/index.js";
+>m7 : Symbol(m7, Decl(index.cjs, 7, 6))
+
+import * as m8 from "./subfolder2/index.mjs";
+>m8 : Symbol(m8, Decl(index.cjs, 8, 6))
+
+import * as m9 from "./subfolder2/index.cjs";
+>m9 : Symbol(m9, Decl(index.cjs, 9, 6))
+
+import * as m10 from "./subfolder2/another/index.js";
+>m10 : Symbol(m10, Decl(index.cjs, 10, 6))
+
+import * as m11 from "./subfolder2/another/index.mjs";
+>m11 : Symbol(m11, Decl(index.cjs, 11, 6))
+
+import * as m12 from "./subfolder2/another/index.cjs";
+>m12 : Symbol(m12, Decl(index.cjs, 12, 6))
+
+void m1;
+>m1 : Symbol(m1, Decl(index.cjs, 1, 6))
+
+void m2;
+>m2 : Symbol(m2, Decl(index.cjs, 2, 6))
+
+void m3;
+>m3 : Symbol(m3, Decl(index.cjs, 3, 6))
+
+void m4;
+>m4 : Symbol(m4, Decl(index.cjs, 4, 6))
+
+void m5;
+>m5 : Symbol(m5, Decl(index.cjs, 5, 6))
+
+void m6;
+>m6 : Symbol(m6, Decl(index.cjs, 6, 6))
+
+void m7;
+>m7 : Symbol(m7, Decl(index.cjs, 7, 6))
+
+void m8;
+>m8 : Symbol(m8, Decl(index.cjs, 8, 6))
+
+void m9;
+>m9 : Symbol(m9, Decl(index.cjs, 9, 6))
+
+void m10;
+>m10 : Symbol(m10, Decl(index.cjs, 10, 6))
+
+void m11;
+>m11 : Symbol(m11, Decl(index.cjs, 11, 6))
+
+void m12;
+>m12 : Symbol(m12, Decl(index.cjs, 12, 6))
+
+// cjs format file
+const x = 1;
+>x : Symbol(x, Decl(index.cjs, 26, 5))
+
+export {x};
+>x : Symbol(m3.x, Decl(index.cjs, 27, 8))
+
+=== tests/cases/conformance/node/allowJs/index.mjs ===
+import * as m1 from "./index.js";
+>m1 : Symbol(m1, Decl(index.mjs, 0, 6))
+
+import * as m2 from "./index.mjs";
+>m2 : Symbol(m2, Decl(index.mjs, 1, 6))
+
+import * as m3 from "./index.cjs";
+>m3 : Symbol(m3, Decl(index.mjs, 2, 6))
+
+import * as m4 from "./subfolder/index.js";
+>m4 : Symbol(m4, Decl(index.mjs, 3, 6))
+
+import * as m5 from "./subfolder/index.mjs";
+>m5 : Symbol(m5, Decl(index.mjs, 4, 6))
+
+import * as m6 from "./subfolder/index.cjs";
+>m6 : Symbol(m6, Decl(index.mjs, 5, 6))
+
+import * as m7 from "./subfolder2/index.js";
+>m7 : Symbol(m7, Decl(index.mjs, 6, 6))
+
+import * as m8 from "./subfolder2/index.mjs";
+>m8 : Symbol(m8, Decl(index.mjs, 7, 6))
+
+import * as m9 from "./subfolder2/index.cjs";
+>m9 : Symbol(m9, Decl(index.mjs, 8, 6))
+
+import * as m10 from "./subfolder2/another/index.js";
+>m10 : Symbol(m10, Decl(index.mjs, 9, 6))
+
+import * as m11 from "./subfolder2/another/index.mjs";
+>m11 : Symbol(m11, Decl(index.mjs, 10, 6))
+
+import * as m12 from "./subfolder2/another/index.cjs";
+>m12 : Symbol(m12, Decl(index.mjs, 11, 6))
+
+void m1;
+>m1 : Symbol(m1, Decl(index.mjs, 0, 6))
+
+void m2;
+>m2 : Symbol(m2, Decl(index.mjs, 1, 6))
+
+void m3;
+>m3 : Symbol(m3, Decl(index.mjs, 2, 6))
+
+void m4;
+>m4 : Symbol(m4, Decl(index.mjs, 3, 6))
+
+void m5;
+>m5 : Symbol(m5, Decl(index.mjs, 4, 6))
+
+void m6;
+>m6 : Symbol(m6, Decl(index.mjs, 5, 6))
+
+void m7;
+>m7 : Symbol(m7, Decl(index.mjs, 6, 6))
+
+void m8;
+>m8 : Symbol(m8, Decl(index.mjs, 7, 6))
+
+void m9;
+>m9 : Symbol(m9, Decl(index.mjs, 8, 6))
+
+void m10;
+>m10 : Symbol(m10, Decl(index.mjs, 9, 6))
+
+void m11;
+>m11 : Symbol(m11, Decl(index.mjs, 10, 6))
+
+void m12;
+>m12 : Symbol(m12, Decl(index.mjs, 11, 6))
+
+// esm format file
+const x = 1;
+>x : Symbol(x, Decl(index.mjs, 25, 5))
+
+export {x};
+>x : Symbol(m2.x, Decl(index.mjs, 26, 8))
 
diff --git a/tests/baselines/reference/nodeModulesAllowJs1(module=nodenext).types b/tests/baselines/reference/nodeModulesAllowJs1(module=nodenext).types
index bb0713313ec99..d0acce4132567 100644
--- a/tests/baselines/reference/nodeModulesAllowJs1(module=nodenext).types
+++ b/tests/baselines/reference/nodeModulesAllowJs1(module=nodenext).types
@@ -7,6 +7,24 @@ const x = 1;
 export {x};
 >x : 1
 
+=== tests/cases/conformance/node/allowJs/subfolder/index.cjs ===
+// cjs format file
+const x = 1;
+>x : 1
+>1 : 1
+
+export {x};
+>x : 1
+
+=== tests/cases/conformance/node/allowJs/subfolder/index.mjs ===
+// esm format file
+const x = 1;
+>x : 1
+>1 : 1
+
+export {x};
+>x : 1
+
 === tests/cases/conformance/node/allowJs/subfolder2/index.js ===
 // cjs format file
 const x = 1;
@@ -16,6 +34,24 @@ const x = 1;
 export {x};
 >x : 1
 
+=== tests/cases/conformance/node/allowJs/subfolder2/index.cjs ===
+// cjs format file
+const x = 1;
+>x : 1
+>1 : 1
+
+export {x};
+>x : 1
+
+=== tests/cases/conformance/node/allowJs/subfolder2/index.mjs ===
+// esm format file
+const x = 1;
+>x : 1
+>1 : 1
+
+export {x};
+>x : 1
+
 === tests/cases/conformance/node/allowJs/subfolder2/another/index.js ===
 // esm format file
 const x = 1;
@@ -25,7 +61,296 @@ const x = 1;
 export {x};
 >x : 1
 
+=== tests/cases/conformance/node/allowJs/subfolder2/another/index.cjs ===
+// cjs format file
+const x = 1;
+>x : 1
+>1 : 1
+
+export {x};
+>x : 1
+
+=== tests/cases/conformance/node/allowJs/subfolder2/another/index.mjs ===
+// esm format file
+const x = 1;
+>x : 1
+>1 : 1
+
+export {x};
+>x : 1
+
 === tests/cases/conformance/node/allowJs/index.js ===
+import * as m1 from "./index.js";
+>m1 : typeof m1
+
+import * as m2 from "./index.mjs";
+>m2 : typeof m2
+
+import * as m3 from "./index.cjs";
+>m3 : typeof m3
+
+import * as m4 from "./subfolder/index.js";
+>m4 : typeof m4
+
+import * as m5 from "./subfolder/index.mjs";
+>m5 : typeof m5
+
+import * as m6 from "./subfolder/index.cjs";
+>m6 : typeof m6
+
+import * as m7 from "./subfolder2/index.js";
+>m7 : typeof m7
+
+import * as m8 from "./subfolder2/index.mjs";
+>m8 : typeof m8
+
+import * as m9 from "./subfolder2/index.cjs";
+>m9 : typeof m9
+
+import * as m10 from "./subfolder2/another/index.js";
+>m10 : typeof m10
+
+import * as m11 from "./subfolder2/another/index.mjs";
+>m11 : typeof m11
+
+import * as m12 from "./subfolder2/another/index.cjs";
+>m12 : typeof m12
+
+void m1;
+>void m1 : undefined
+>m1 : typeof m1
+
+void m2;
+>void m2 : undefined
+>m2 : typeof m2
+
+void m3;
+>void m3 : undefined
+>m3 : typeof m3
+
+void m4;
+>void m4 : undefined
+>m4 : typeof m4
+
+void m5;
+>void m5 : undefined
+>m5 : typeof m5
+
+void m6;
+>void m6 : undefined
+>m6 : typeof m6
+
+void m7;
+>void m7 : undefined
+>m7 : typeof m7
+
+void m8;
+>void m8 : undefined
+>m8 : typeof m8
+
+void m9;
+>void m9 : undefined
+>m9 : typeof m9
+
+void m10;
+>void m10 : undefined
+>m10 : typeof m10
+
+void m11;
+>void m11 : undefined
+>m11 : typeof m11
+
+void m12;
+>void m12 : undefined
+>m12 : typeof m12
+
+// esm format file
+const x = 1;
+>x : 1
+>1 : 1
+
+export {x};
+>x : 1
+
+=== tests/cases/conformance/node/allowJs/index.cjs ===
+// ESM format imports below should error
+import * as m1 from "./index.js";
+>m1 : typeof m1
+
+import * as m2 from "./index.mjs";
+>m2 : typeof m2
+
+import * as m3 from "./index.cjs";
+>m3 : typeof m3
+
+import * as m4 from "./subfolder/index.js";
+>m4 : typeof m4
+
+import * as m5 from "./subfolder/index.mjs";
+>m5 : typeof m5
+
+import * as m6 from "./subfolder/index.cjs";
+>m6 : typeof m6
+
+import * as m7 from "./subfolder2/index.js";
+>m7 : typeof m7
+
+import * as m8 from "./subfolder2/index.mjs";
+>m8 : typeof m8
+
+import * as m9 from "./subfolder2/index.cjs";
+>m9 : typeof m9
+
+import * as m10 from "./subfolder2/another/index.js";
+>m10 : typeof m10
+
+import * as m11 from "./subfolder2/another/index.mjs";
+>m11 : typeof m11
+
+import * as m12 from "./subfolder2/another/index.cjs";
+>m12 : typeof m12
+
+void m1;
+>void m1 : undefined
+>m1 : typeof m1
+
+void m2;
+>void m2 : undefined
+>m2 : typeof m2
+
+void m3;
+>void m3 : undefined
+>m3 : typeof m3
+
+void m4;
+>void m4 : undefined
+>m4 : typeof m4
+
+void m5;
+>void m5 : undefined
+>m5 : typeof m5
+
+void m6;
+>void m6 : undefined
+>m6 : typeof m6
+
+void m7;
+>void m7 : undefined
+>m7 : typeof m7
+
+void m8;
+>void m8 : undefined
+>m8 : typeof m8
+
+void m9;
+>void m9 : undefined
+>m9 : typeof m9
+
+void m10;
+>void m10 : undefined
+>m10 : typeof m10
+
+void m11;
+>void m11 : undefined
+>m11 : typeof m11
+
+void m12;
+>void m12 : undefined
+>m12 : typeof m12
+
+// cjs format file
+const x = 1;
+>x : 1
+>1 : 1
+
+export {x};
+>x : 1
+
+=== tests/cases/conformance/node/allowJs/index.mjs ===
+import * as m1 from "./index.js";
+>m1 : typeof m1
+
+import * as m2 from "./index.mjs";
+>m2 : typeof m2
+
+import * as m3 from "./index.cjs";
+>m3 : typeof m3
+
+import * as m4 from "./subfolder/index.js";
+>m4 : typeof m4
+
+import * as m5 from "./subfolder/index.mjs";
+>m5 : typeof m5
+
+import * as m6 from "./subfolder/index.cjs";
+>m6 : typeof m6
+
+import * as m7 from "./subfolder2/index.js";
+>m7 : typeof m7
+
+import * as m8 from "./subfolder2/index.mjs";
+>m8 : typeof m8
+
+import * as m9 from "./subfolder2/index.cjs";
+>m9 : typeof m9
+
+import * as m10 from "./subfolder2/another/index.js";
+>m10 : typeof m10
+
+import * as m11 from "./subfolder2/another/index.mjs";
+>m11 : typeof m11
+
+import * as m12 from "./subfolder2/another/index.cjs";
+>m12 : typeof m12
+
+void m1;
+>void m1 : undefined
+>m1 : typeof m1
+
+void m2;
+>void m2 : undefined
+>m2 : typeof m2
+
+void m3;
+>void m3 : undefined
+>m3 : typeof m3
+
+void m4;
+>void m4 : undefined
+>m4 : typeof m4
+
+void m5;
+>void m5 : undefined
+>m5 : typeof m5
+
+void m6;
+>void m6 : undefined
+>m6 : typeof m6
+
+void m7;
+>void m7 : undefined
+>m7 : typeof m7
+
+void m8;
+>void m8 : undefined
+>m8 : typeof m8
+
+void m9;
+>void m9 : undefined
+>m9 : typeof m9
+
+void m10;
+>void m10 : undefined
+>m10 : typeof m10
+
+void m11;
+>void m11 : undefined
+>m11 : typeof m11
+
+void m12;
+>void m12 : undefined
+>m12 : typeof m12
+
 // esm format file
 const x = 1;
 >x : 1
diff --git a/tests/baselines/reference/nodeModulesForbidenSyntax(module=node12).errors.txt b/tests/baselines/reference/nodeModulesForbidenSyntax(module=node12).errors.txt
new file mode 100644
index 0000000000000..984483a332e29
--- /dev/null
+++ b/tests/baselines/reference/nodeModulesForbidenSyntax(module=node12).errors.txt
@@ -0,0 +1,139 @@
+tests/cases/conformance/node/index.cts(2,12): error TS7060: This syntax is reserved in files with the .mts or .cts extension. Add a trailing comma or explicit constraint.
+tests/cases/conformance/node/index.cts(2,20): error TS7059: This syntax is reserved in files with the .mts or .cts extension. Use an `as` expression instead.
+tests/cases/conformance/node/index.cts(2,23): error TS7059: This syntax is reserved in files with the .mts or .cts extension. Use an `as` expression instead.
+tests/cases/conformance/node/index.mts(2,12): error TS7060: This syntax is reserved in files with the .mts or .cts extension. Add a trailing comma or explicit constraint.
+tests/cases/conformance/node/index.mts(2,20): error TS7059: This syntax is reserved in files with the .mts or .cts extension. Use an `as` expression instead.
+tests/cases/conformance/node/index.mts(2,23): error TS7059: This syntax is reserved in files with the .mts or .cts extension. Use an `as` expression instead.
+tests/cases/conformance/node/subfolder/index.cts(2,12): error TS7060: This syntax is reserved in files with the .mts or .cts extension. Add a trailing comma or explicit constraint.
+tests/cases/conformance/node/subfolder/index.cts(2,20): error TS7059: This syntax is reserved in files with the .mts or .cts extension. Use an `as` expression instead.
+tests/cases/conformance/node/subfolder/index.cts(2,23): error TS7059: This syntax is reserved in files with the .mts or .cts extension. Use an `as` expression instead.
+tests/cases/conformance/node/subfolder/index.mts(2,12): error TS7060: This syntax is reserved in files with the .mts or .cts extension. Add a trailing comma or explicit constraint.
+tests/cases/conformance/node/subfolder/index.mts(2,20): error TS7059: This syntax is reserved in files with the .mts or .cts extension. Use an `as` expression instead.
+tests/cases/conformance/node/subfolder/index.mts(2,23): error TS7059: This syntax is reserved in files with the .mts or .cts extension. Use an `as` expression instead.
+tests/cases/conformance/node/subfolder2/another/index.cts(2,12): error TS7060: This syntax is reserved in files with the .mts or .cts extension. Add a trailing comma or explicit constraint.
+tests/cases/conformance/node/subfolder2/another/index.cts(2,20): error TS7059: This syntax is reserved in files with the .mts or .cts extension. Use an `as` expression instead.
+tests/cases/conformance/node/subfolder2/another/index.cts(2,23): error TS7059: This syntax is reserved in files with the .mts or .cts extension. Use an `as` expression instead.
+tests/cases/conformance/node/subfolder2/another/index.mts(2,12): error TS7060: This syntax is reserved in files with the .mts or .cts extension. Add a trailing comma or explicit constraint.
+tests/cases/conformance/node/subfolder2/another/index.mts(2,20): error TS7059: This syntax is reserved in files with the .mts or .cts extension. Use an `as` expression instead.
+tests/cases/conformance/node/subfolder2/another/index.mts(2,23): error TS7059: This syntax is reserved in files with the .mts or .cts extension. Use an `as` expression instead.
+tests/cases/conformance/node/subfolder2/index.cts(2,12): error TS7060: This syntax is reserved in files with the .mts or .cts extension. Add a trailing comma or explicit constraint.
+tests/cases/conformance/node/subfolder2/index.cts(2,20): error TS7059: This syntax is reserved in files with the .mts or .cts extension. Use an `as` expression instead.
+tests/cases/conformance/node/subfolder2/index.cts(2,23): error TS7059: This syntax is reserved in files with the .mts or .cts extension. Use an `as` expression instead.
+tests/cases/conformance/node/subfolder2/index.mts(2,12): error TS7060: This syntax is reserved in files with the .mts or .cts extension. Add a trailing comma or explicit constraint.
+tests/cases/conformance/node/subfolder2/index.mts(2,20): error TS7059: This syntax is reserved in files with the .mts or .cts extension. Use an `as` expression instead.
+tests/cases/conformance/node/subfolder2/index.mts(2,23): error TS7059: This syntax is reserved in files with the .mts or .cts extension. Use an `as` expression instead.
+
+
+==== tests/cases/conformance/node/subfolder/index.ts (0 errors) ====
+    // cjs format file
+    const x = <T>() => <T><any>(void 0);
+    export {x};
+==== tests/cases/conformance/node/subfolder/index.cts (3 errors) ====
+    // cjs format file
+    const x = <T>() => <T><any>(void 0);
+               ~
+!!! error TS7060: This syntax is reserved in files with the .mts or .cts extension. Add a trailing comma or explicit constraint.
+                       ~~~~~~~~~~~~~~~~
+!!! error TS7059: This syntax is reserved in files with the .mts or .cts extension. Use an `as` expression instead.
+                          ~~~~~~~~~~~~~
+!!! error TS7059: This syntax is reserved in files with the .mts or .cts extension. Use an `as` expression instead.
+    export {x};
+==== tests/cases/conformance/node/subfolder/index.mts (3 errors) ====
+    // esm format file
+    const x = <T>() => <T><any>(void 0);
+               ~
+!!! error TS7060: This syntax is reserved in files with the .mts or .cts extension. Add a trailing comma or explicit constraint.
+                       ~~~~~~~~~~~~~~~~
+!!! error TS7059: This syntax is reserved in files with the .mts or .cts extension. Use an `as` expression instead.
+                          ~~~~~~~~~~~~~
+!!! error TS7059: This syntax is reserved in files with the .mts or .cts extension. Use an `as` expression instead.
+    export {x};
+==== tests/cases/conformance/node/subfolder2/index.ts (0 errors) ====
+    // cjs format file
+    const x = <T>() => <T><any>(void 0);
+    export {x};
+==== tests/cases/conformance/node/subfolder2/index.cts (3 errors) ====
+    // cjs format file
+    const x = <T>() => <T><any>(void 0);
+               ~
+!!! error TS7060: This syntax is reserved in files with the .mts or .cts extension. Add a trailing comma or explicit constraint.
+                       ~~~~~~~~~~~~~~~~
+!!! error TS7059: This syntax is reserved in files with the .mts or .cts extension. Use an `as` expression instead.
+                          ~~~~~~~~~~~~~
+!!! error TS7059: This syntax is reserved in files with the .mts or .cts extension. Use an `as` expression instead.
+    export {x};
+==== tests/cases/conformance/node/subfolder2/index.mts (3 errors) ====
+    // esm format file
+    const x = <T>() => <T><any>(void 0);
+               ~
+!!! error TS7060: This syntax is reserved in files with the .mts or .cts extension. Add a trailing comma or explicit constraint.
+                       ~~~~~~~~~~~~~~~~
+!!! error TS7059: This syntax is reserved in files with the .mts or .cts extension. Use an `as` expression instead.
+                          ~~~~~~~~~~~~~
+!!! error TS7059: This syntax is reserved in files with the .mts or .cts extension. Use an `as` expression instead.
+    export {x};
+==== tests/cases/conformance/node/subfolder2/another/index.ts (0 errors) ====
+    // esm format file
+    const x = <T>() => <T><any>(void 0);
+    export {x};
+==== tests/cases/conformance/node/subfolder2/another/index.mts (3 errors) ====
+    // esm format file
+    const x = <T>() => <T><any>(void 0);
+               ~
+!!! error TS7060: This syntax is reserved in files with the .mts or .cts extension. Add a trailing comma or explicit constraint.
+                       ~~~~~~~~~~~~~~~~
+!!! error TS7059: This syntax is reserved in files with the .mts or .cts extension. Use an `as` expression instead.
+                          ~~~~~~~~~~~~~
+!!! error TS7059: This syntax is reserved in files with the .mts or .cts extension. Use an `as` expression instead.
+    export {x};
+==== tests/cases/conformance/node/subfolder2/another/index.cts (3 errors) ====
+    // cjs format file
+    const x = <T>() => <T><any>(void 0);
+               ~
+!!! error TS7060: This syntax is reserved in files with the .mts or .cts extension. Add a trailing comma or explicit constraint.
+                       ~~~~~~~~~~~~~~~~
+!!! error TS7059: This syntax is reserved in files with the .mts or .cts extension. Use an `as` expression instead.
+                          ~~~~~~~~~~~~~
+!!! error TS7059: This syntax is reserved in files with the .mts or .cts extension. Use an `as` expression instead.
+    export {x};
+==== tests/cases/conformance/node/index.mts (3 errors) ====
+    // esm format file
+    const x = <T>() => <T><any>(void 0);
+               ~
+!!! error TS7060: This syntax is reserved in files with the .mts or .cts extension. Add a trailing comma or explicit constraint.
+                       ~~~~~~~~~~~~~~~~
+!!! error TS7059: This syntax is reserved in files with the .mts or .cts extension. Use an `as` expression instead.
+                          ~~~~~~~~~~~~~
+!!! error TS7059: This syntax is reserved in files with the .mts or .cts extension. Use an `as` expression instead.
+    export {x};
+==== tests/cases/conformance/node/index.cts (3 errors) ====
+    // cjs format file
+    const x = <T>() => <T><any>(void 0);
+               ~
+!!! error TS7060: This syntax is reserved in files with the .mts or .cts extension. Add a trailing comma or explicit constraint.
+                       ~~~~~~~~~~~~~~~~
+!!! error TS7059: This syntax is reserved in files with the .mts or .cts extension. Use an `as` expression instead.
+                          ~~~~~~~~~~~~~
+!!! error TS7059: This syntax is reserved in files with the .mts or .cts extension. Use an `as` expression instead.
+    export {x};
+==== tests/cases/conformance/node/index.ts (0 errors) ====
+    // esm format file
+    const x = <T>() => <T><any>(void 0);
+    export {x};
+==== tests/cases/conformance/node/package.json (0 errors) ====
+    {
+        "name": "package",
+        "private": true,
+        "type": "module"
+    }
+==== tests/cases/conformance/node/subfolder/package.json (0 errors) ====
+    {
+        "type": "commonjs"
+    }
+==== tests/cases/conformance/node/subfolder2/package.json (0 errors) ====
+    {
+    }
+==== tests/cases/conformance/node/subfolder2/another/package.json (0 errors) ====
+    {
+        "type": "module"
+    }
\ No newline at end of file
diff --git a/tests/baselines/reference/nodeModulesForbidenSyntax(module=node12).js b/tests/baselines/reference/nodeModulesForbidenSyntax(module=node12).js
new file mode 100644
index 0000000000000..4cca6af5a58d7
--- /dev/null
+++ b/tests/baselines/reference/nodeModulesForbidenSyntax(module=node12).js
@@ -0,0 +1,172 @@
+//// [tests/cases/conformance/node/nodeModulesForbidenSyntax.ts] ////
+
+//// [index.ts]
+// cjs format file
+const x = <T>() => <T><any>(void 0);
+export {x};
+//// [index.cts]
+// cjs format file
+const x = <T>() => <T><any>(void 0);
+export {x};
+//// [index.mts]
+// esm format file
+const x = <T>() => <T><any>(void 0);
+export {x};
+//// [index.ts]
+// cjs format file
+const x = <T>() => <T><any>(void 0);
+export {x};
+//// [index.cts]
+// cjs format file
+const x = <T>() => <T><any>(void 0);
+export {x};
+//// [index.mts]
+// esm format file
+const x = <T>() => <T><any>(void 0);
+export {x};
+//// [index.ts]
+// esm format file
+const x = <T>() => <T><any>(void 0);
+export {x};
+//// [index.mts]
+// esm format file
+const x = <T>() => <T><any>(void 0);
+export {x};
+//// [index.cts]
+// cjs format file
+const x = <T>() => <T><any>(void 0);
+export {x};
+//// [index.mts]
+// esm format file
+const x = <T>() => <T><any>(void 0);
+export {x};
+//// [index.cts]
+// cjs format file
+const x = <T>() => <T><any>(void 0);
+export {x};
+//// [index.ts]
+// esm format file
+const x = <T>() => <T><any>(void 0);
+export {x};
+//// [package.json]
+{
+    "name": "package",
+    "private": true,
+    "type": "module"
+}
+//// [package.json]
+{
+    "type": "commonjs"
+}
+//// [package.json]
+{
+}
+//// [package.json]
+{
+    "type": "module"
+}
+
+//// [index.js]
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.x = void 0;
+// cjs format file
+const x = () => (void 0);
+exports.x = x;
+//// [index.cjs]
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.x = void 0;
+// cjs format file
+const x = () => (void 0);
+exports.x = x;
+//// [index.mjs]
+// esm format file
+const x = () => (void 0);
+export { x };
+//// [index.js]
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.x = void 0;
+// cjs format file
+const x = () => (void 0);
+exports.x = x;
+//// [index.cjs]
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.x = void 0;
+// cjs format file
+const x = () => (void 0);
+exports.x = x;
+//// [index.mjs]
+// esm format file
+const x = () => (void 0);
+export { x };
+//// [index.js]
+// esm format file
+const x = () => (void 0);
+export { x };
+//// [index.mjs]
+// esm format file
+const x = () => (void 0);
+export { x };
+//// [index.cjs]
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.x = void 0;
+// cjs format file
+const x = () => (void 0);
+exports.x = x;
+//// [index.mjs]
+// esm format file
+const x = () => (void 0);
+export { x };
+//// [index.cjs]
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.x = void 0;
+// cjs format file
+const x = () => (void 0);
+exports.x = x;
+//// [index.js]
+// esm format file
+const x = () => (void 0);
+export { x };
+
+
+//// [index.d.ts]
+declare const x: <T>() => T;
+export { x };
+//// [index.d.cts]
+declare const x: <T>() => T;
+export { x };
+//// [index.d.mts]
+declare const x: <T>() => T;
+export { x };
+//// [index.d.ts]
+declare const x: <T>() => T;
+export { x };
+//// [index.d.cts]
+declare const x: <T>() => T;
+export { x };
+//// [index.d.mts]
+declare const x: <T>() => T;
+export { x };
+//// [index.d.ts]
+declare const x: <T>() => T;
+export { x };
+//// [index.d.mts]
+declare const x: <T>() => T;
+export { x };
+//// [index.d.cts]
+declare const x: <T>() => T;
+export { x };
+//// [index.d.mts]
+declare const x: <T>() => T;
+export { x };
+//// [index.d.cts]
+declare const x: <T>() => T;
+export { x };
+//// [index.d.ts]
+declare const x: <T>() => T;
+export { x };
diff --git a/tests/baselines/reference/nodeModulesForbidenSyntax(module=node12).symbols b/tests/baselines/reference/nodeModulesForbidenSyntax(module=node12).symbols
new file mode 100644
index 0000000000000..1ca35d0d3e32e
--- /dev/null
+++ b/tests/baselines/reference/nodeModulesForbidenSyntax(module=node12).symbols
@@ -0,0 +1,120 @@
+=== tests/cases/conformance/node/subfolder/index.ts ===
+// cjs format file
+const x = <T>() => <T><any>(void 0);
+>x : Symbol(x, Decl(index.ts, 1, 5))
+>T : Symbol(T, Decl(index.ts, 1, 11))
+>T : Symbol(T, Decl(index.ts, 1, 11))
+
+export {x};
+>x : Symbol(x, Decl(index.ts, 2, 8))
+
+=== tests/cases/conformance/node/subfolder/index.cts ===
+// cjs format file
+const x = <T>() => <T><any>(void 0);
+>x : Symbol(x, Decl(index.cts, 1, 5))
+>T : Symbol(T, Decl(index.cts, 1, 11))
+>T : Symbol(T, Decl(index.cts, 1, 11))
+
+export {x};
+>x : Symbol(x, Decl(index.cts, 2, 8))
+
+=== tests/cases/conformance/node/subfolder/index.mts ===
+// esm format file
+const x = <T>() => <T><any>(void 0);
+>x : Symbol(x, Decl(index.mts, 1, 5))
+>T : Symbol(T, Decl(index.mts, 1, 11))
+>T : Symbol(T, Decl(index.mts, 1, 11))
+
+export {x};
+>x : Symbol(x, Decl(index.mts, 2, 8))
+
+=== tests/cases/conformance/node/subfolder2/index.ts ===
+// cjs format file
+const x = <T>() => <T><any>(void 0);
+>x : Symbol(x, Decl(index.ts, 1, 5))
+>T : Symbol(T, Decl(index.ts, 1, 11))
+>T : Symbol(T, Decl(index.ts, 1, 11))
+
+export {x};
+>x : Symbol(x, Decl(index.ts, 2, 8))
+
+=== tests/cases/conformance/node/subfolder2/index.cts ===
+// cjs format file
+const x = <T>() => <T><any>(void 0);
+>x : Symbol(x, Decl(index.cts, 1, 5))
+>T : Symbol(T, Decl(index.cts, 1, 11))
+>T : Symbol(T, Decl(index.cts, 1, 11))
+
+export {x};
+>x : Symbol(x, Decl(index.cts, 2, 8))
+
+=== tests/cases/conformance/node/subfolder2/index.mts ===
+// esm format file
+const x = <T>() => <T><any>(void 0);
+>x : Symbol(x, Decl(index.mts, 1, 5))
+>T : Symbol(T, Decl(index.mts, 1, 11))
+>T : Symbol(T, Decl(index.mts, 1, 11))
+
+export {x};
+>x : Symbol(x, Decl(index.mts, 2, 8))
+
+=== tests/cases/conformance/node/subfolder2/another/index.ts ===
+// esm format file
+const x = <T>() => <T><any>(void 0);
+>x : Symbol(x, Decl(index.ts, 1, 5))
+>T : Symbol(T, Decl(index.ts, 1, 11))
+>T : Symbol(T, Decl(index.ts, 1, 11))
+
+export {x};
+>x : Symbol(x, Decl(index.ts, 2, 8))
+
+=== tests/cases/conformance/node/subfolder2/another/index.mts ===
+// esm format file
+const x = <T>() => <T><any>(void 0);
+>x : Symbol(x, Decl(index.mts, 1, 5))
+>T : Symbol(T, Decl(index.mts, 1, 11))
+>T : Symbol(T, Decl(index.mts, 1, 11))
+
+export {x};
+>x : Symbol(x, Decl(index.mts, 2, 8))
+
+=== tests/cases/conformance/node/subfolder2/another/index.cts ===
+// cjs format file
+const x = <T>() => <T><any>(void 0);
+>x : Symbol(x, Decl(index.cts, 1, 5))
+>T : Symbol(T, Decl(index.cts, 1, 11))
+>T : Symbol(T, Decl(index.cts, 1, 11))
+
+export {x};
+>x : Symbol(x, Decl(index.cts, 2, 8))
+
+=== tests/cases/conformance/node/index.mts ===
+// esm format file
+const x = <T>() => <T><any>(void 0);
+>x : Symbol(x, Decl(index.mts, 1, 5))
+>T : Symbol(T, Decl(index.mts, 1, 11))
+>T : Symbol(T, Decl(index.mts, 1, 11))
+
+export {x};
+>x : Symbol(x, Decl(index.mts, 2, 8))
+
+=== tests/cases/conformance/node/index.cts ===
+// cjs format file
+const x = <T>() => <T><any>(void 0);
+>x : Symbol(x, Decl(index.cts, 1, 5))
+>T : Symbol(T, Decl(index.cts, 1, 11))
+>T : Symbol(T, Decl(index.cts, 1, 11))
+
+export {x};
+>x : Symbol(x, Decl(index.cts, 2, 8))
+
+=== tests/cases/conformance/node/index.ts ===
+// esm format file
+const x = <T>() => <T><any>(void 0);
+>x : Symbol(x, Decl(index.ts, 1, 5))
+>T : Symbol(T, Decl(index.ts, 1, 11))
+>T : Symbol(T, Decl(index.ts, 1, 11))
+
+export {x};
+>x : Symbol(x, Decl(index.ts, 2, 8))
+
diff --git a/tests/baselines/reference/nodeModulesForbidenSyntax(module=node12).types b/tests/baselines/reference/nodeModulesForbidenSyntax(module=node12).types
new file mode 100644
index 0000000000000..016af4314d16b
--- /dev/null
+++ b/tests/baselines/reference/nodeModulesForbidenSyntax(module=node12).types
@@ -0,0 +1,168 @@
+=== tests/cases/conformance/node/subfolder/index.ts ===
+// cjs format file
+const x = <T>() => <T><any>(void 0);
+>x : <T>() => T
+><T>() => <T><any>(void 0) : <T>() => T
+><T><any>(void 0) : T
+><any>(void 0) : any
+>(void 0) : undefined
+>void 0 : undefined
+>0 : 0
+
+export {x};
+>x : <T>() => T
+
+=== tests/cases/conformance/node/subfolder/index.cts ===
+// cjs format file
+const x = <T>() => <T><any>(void 0);
+>x : <T>() => T
+><T>() => <T><any>(void 0) : <T>() => T
+><T><any>(void 0) : T
+><any>(void 0) : any
+>(void 0) : undefined
+>void 0 : undefined
+>0 : 0
+
+export {x};
+>x : <T>() => T
+
+=== tests/cases/conformance/node/subfolder/index.mts ===
+// esm format file
+const x = <T>() => <T><any>(void 0);
+>x : <T>() => T
+><T>() => <T><any>(void 0) : <T>() => T
+><T><any>(void 0) : T
+><any>(void 0) : any
+>(void 0) : undefined
+>void 0 : undefined
+>0 : 0
+
+export {x};
+>x : <T>() => T
+
+=== tests/cases/conformance/node/subfolder2/index.ts ===
+// cjs format file
+const x = <T>() => <T><any>(void 0);
+>x : <T>() => T
+><T>() => <T><any>(void 0) : <T>() => T
+><T><any>(void 0) : T
+><any>(void 0) : any
+>(void 0) : undefined
+>void 0 : undefined
+>0 : 0
+
+export {x};
+>x : <T>() => T
+
+=== tests/cases/conformance/node/subfolder2/index.cts ===
+// cjs format file
+const x = <T>() => <T><any>(void 0);
+>x : <T>() => T
+><T>() => <T><any>(void 0) : <T>() => T
+><T><any>(void 0) : T
+><any>(void 0) : any
+>(void 0) : undefined
+>void 0 : undefined
+>0 : 0
+
+export {x};
+>x : <T>() => T
+
+=== tests/cases/conformance/node/subfolder2/index.mts ===
+// esm format file
+const x = <T>() => <T><any>(void 0);
+>x : <T>() => T
+><T>() => <T><any>(void 0) : <T>() => T
+><T><any>(void 0) : T
+><any>(void 0) : any
+>(void 0) : undefined
+>void 0 : undefined
+>0 : 0
+
+export {x};
+>x : <T>() => T
+
+=== tests/cases/conformance/node/subfolder2/another/index.ts ===
+// esm format file
+const x = <T>() => <T><any>(void 0);
+>x : <T>() => T
+><T>() => <T><any>(void 0) : <T>() => T
+><T><any>(void 0) : T
+><any>(void 0) : any
+>(void 0) : undefined
+>void 0 : undefined
+>0 : 0
+
+export {x};
+>x : <T>() => T
+
+=== tests/cases/conformance/node/subfolder2/another/index.mts ===
+// esm format file
+const x = <T>() => <T><any>(void 0);
+>x : <T>() => T
+><T>() => <T><any>(void 0) : <T>() => T
+><T><any>(void 0) : T
+><any>(void 0) : any
+>(void 0) : undefined
+>void 0 : undefined
+>0 : 0
+
+export {x};
+>x : <T>() => T
+
+=== tests/cases/conformance/node/subfolder2/another/index.cts ===
+// cjs format file
+const x = <T>() => <T><any>(void 0);
+>x : <T>() => T
+><T>() => <T><any>(void 0) : <T>() => T
+><T><any>(void 0) : T
+><any>(void 0) : any
+>(void 0) : undefined
+>void 0 : undefined
+>0 : 0
+
+export {x};
+>x : <T>() => T
+
+=== tests/cases/conformance/node/index.mts ===
+// esm format file
+const x = <T>() => <T><any>(void 0);
+>x : <T>() => T
+><T>() => <T><any>(void 0) : <T>() => T
+><T><any>(void 0) : T
+><any>(void 0) : any
+>(void 0) : undefined
+>void 0 : undefined
+>0 : 0
+
+export {x};
+>x : <T>() => T
+
+=== tests/cases/conformance/node/index.cts ===
+// cjs format file
+const x = <T>() => <T><any>(void 0);
+>x : <T>() => T
+><T>() => <T><any>(void 0) : <T>() => T
+><T><any>(void 0) : T
+><any>(void 0) : any
+>(void 0) : undefined
+>void 0 : undefined
+>0 : 0
+
+export {x};
+>x : <T>() => T
+
+=== tests/cases/conformance/node/index.ts ===
+// esm format file
+const x = <T>() => <T><any>(void 0);
+>x : <T>() => T
+><T>() => <T><any>(void 0) : <T>() => T
+><T><any>(void 0) : T
+><any>(void 0) : any
+>(void 0) : undefined
+>void 0 : undefined
+>0 : 0
+
+export {x};
+>x : <T>() => T
+
diff --git a/tests/baselines/reference/nodeModulesForbidenSyntax(module=nodenext).errors.txt b/tests/baselines/reference/nodeModulesForbidenSyntax(module=nodenext).errors.txt
new file mode 100644
index 0000000000000..984483a332e29
--- /dev/null
+++ b/tests/baselines/reference/nodeModulesForbidenSyntax(module=nodenext).errors.txt
@@ -0,0 +1,139 @@
+tests/cases/conformance/node/index.cts(2,12): error TS7060: This syntax is reserved in files with the .mts or .cts extension. Add a trailing comma or explicit constraint.
+tests/cases/conformance/node/index.cts(2,20): error TS7059: This syntax is reserved in files with the .mts or .cts extension. Use an `as` expression instead.
+tests/cases/conformance/node/index.cts(2,23): error TS7059: This syntax is reserved in files with the .mts or .cts extension. Use an `as` expression instead.
+tests/cases/conformance/node/index.mts(2,12): error TS7060: This syntax is reserved in files with the .mts or .cts extension. Add a trailing comma or explicit constraint.
+tests/cases/conformance/node/index.mts(2,20): error TS7059: This syntax is reserved in files with the .mts or .cts extension. Use an `as` expression instead.
+tests/cases/conformance/node/index.mts(2,23): error TS7059: This syntax is reserved in files with the .mts or .cts extension. Use an `as` expression instead.
+tests/cases/conformance/node/subfolder/index.cts(2,12): error TS7060: This syntax is reserved in files with the .mts or .cts extension. Add a trailing comma or explicit constraint.
+tests/cases/conformance/node/subfolder/index.cts(2,20): error TS7059: This syntax is reserved in files with the .mts or .cts extension. Use an `as` expression instead.
+tests/cases/conformance/node/subfolder/index.cts(2,23): error TS7059: This syntax is reserved in files with the .mts or .cts extension. Use an `as` expression instead.
+tests/cases/conformance/node/subfolder/index.mts(2,12): error TS7060: This syntax is reserved in files with the .mts or .cts extension. Add a trailing comma or explicit constraint.
+tests/cases/conformance/node/subfolder/index.mts(2,20): error TS7059: This syntax is reserved in files with the .mts or .cts extension. Use an `as` expression instead.
+tests/cases/conformance/node/subfolder/index.mts(2,23): error TS7059: This syntax is reserved in files with the .mts or .cts extension. Use an `as` expression instead.
+tests/cases/conformance/node/subfolder2/another/index.cts(2,12): error TS7060: This syntax is reserved in files with the .mts or .cts extension. Add a trailing comma or explicit constraint.
+tests/cases/conformance/node/subfolder2/another/index.cts(2,20): error TS7059: This syntax is reserved in files with the .mts or .cts extension. Use an `as` expression instead.
+tests/cases/conformance/node/subfolder2/another/index.cts(2,23): error TS7059: This syntax is reserved in files with the .mts or .cts extension. Use an `as` expression instead.
+tests/cases/conformance/node/subfolder2/another/index.mts(2,12): error TS7060: This syntax is reserved in files with the .mts or .cts extension. Add a trailing comma or explicit constraint.
+tests/cases/conformance/node/subfolder2/another/index.mts(2,20): error TS7059: This syntax is reserved in files with the .mts or .cts extension. Use an `as` expression instead.
+tests/cases/conformance/node/subfolder2/another/index.mts(2,23): error TS7059: This syntax is reserved in files with the .mts or .cts extension. Use an `as` expression instead.
+tests/cases/conformance/node/subfolder2/index.cts(2,12): error TS7060: This syntax is reserved in files with the .mts or .cts extension. Add a trailing comma or explicit constraint.
+tests/cases/conformance/node/subfolder2/index.cts(2,20): error TS7059: This syntax is reserved in files with the .mts or .cts extension. Use an `as` expression instead.
+tests/cases/conformance/node/subfolder2/index.cts(2,23): error TS7059: This syntax is reserved in files with the .mts or .cts extension. Use an `as` expression instead.
+tests/cases/conformance/node/subfolder2/index.mts(2,12): error TS7060: This syntax is reserved in files with the .mts or .cts extension. Add a trailing comma or explicit constraint.
+tests/cases/conformance/node/subfolder2/index.mts(2,20): error TS7059: This syntax is reserved in files with the .mts or .cts extension. Use an `as` expression instead.
+tests/cases/conformance/node/subfolder2/index.mts(2,23): error TS7059: This syntax is reserved in files with the .mts or .cts extension. Use an `as` expression instead.
+
+
+==== tests/cases/conformance/node/subfolder/index.ts (0 errors) ====
+    // cjs format file
+    const x = <T>() => <T><any>(void 0);
+    export {x};
+==== tests/cases/conformance/node/subfolder/index.cts (3 errors) ====
+    // cjs format file
+    const x = <T>() => <T><any>(void 0);
+               ~
+!!! error TS7060: This syntax is reserved in files with the .mts or .cts extension. Add a trailing comma or explicit constraint.
+                       ~~~~~~~~~~~~~~~~
+!!! error TS7059: This syntax is reserved in files with the .mts or .cts extension. Use an `as` expression instead.
+                          ~~~~~~~~~~~~~
+!!! error TS7059: This syntax is reserved in files with the .mts or .cts extension. Use an `as` expression instead.
+    export {x};
+==== tests/cases/conformance/node/subfolder/index.mts (3 errors) ====
+    // esm format file
+    const x = <T>() => <T><any>(void 0);
+               ~
+!!! error TS7060: This syntax is reserved in files with the .mts or .cts extension. Add a trailing comma or explicit constraint.
+                       ~~~~~~~~~~~~~~~~
+!!! error TS7059: This syntax is reserved in files with the .mts or .cts extension. Use an `as` expression instead.
+                          ~~~~~~~~~~~~~
+!!! error TS7059: This syntax is reserved in files with the .mts or .cts extension. Use an `as` expression instead.
+    export {x};
+==== tests/cases/conformance/node/subfolder2/index.ts (0 errors) ====
+    // cjs format file
+    const x = <T>() => <T><any>(void 0);
+    export {x};
+==== tests/cases/conformance/node/subfolder2/index.cts (3 errors) ====
+    // cjs format file
+    const x = <T>() => <T><any>(void 0);
+               ~
+!!! error TS7060: This syntax is reserved in files with the .mts or .cts extension. Add a trailing comma or explicit constraint.
+                       ~~~~~~~~~~~~~~~~
+!!! error TS7059: This syntax is reserved in files with the .mts or .cts extension. Use an `as` expression instead.
+                          ~~~~~~~~~~~~~
+!!! error TS7059: This syntax is reserved in files with the .mts or .cts extension. Use an `as` expression instead.
+    export {x};
+==== tests/cases/conformance/node/subfolder2/index.mts (3 errors) ====
+    // esm format file
+    const x = <T>() => <T><any>(void 0);
+               ~
+!!! error TS7060: This syntax is reserved in files with the .mts or .cts extension. Add a trailing comma or explicit constraint.
+                       ~~~~~~~~~~~~~~~~
+!!! error TS7059: This syntax is reserved in files with the .mts or .cts extension. Use an `as` expression instead.
+                          ~~~~~~~~~~~~~
+!!! error TS7059: This syntax is reserved in files with the .mts or .cts extension. Use an `as` expression instead.
+    export {x};
+==== tests/cases/conformance/node/subfolder2/another/index.ts (0 errors) ====
+    // esm format file
+    const x = <T>() => <T><any>(void 0);
+    export {x};
+==== tests/cases/conformance/node/subfolder2/another/index.mts (3 errors) ====
+    // esm format file
+    const x = <T>() => <T><any>(void 0);
+               ~
+!!! error TS7060: This syntax is reserved in files with the .mts or .cts extension. Add a trailing comma or explicit constraint.
+                       ~~~~~~~~~~~~~~~~
+!!! error TS7059: This syntax is reserved in files with the .mts or .cts extension. Use an `as` expression instead.
+                          ~~~~~~~~~~~~~
+!!! error TS7059: This syntax is reserved in files with the .mts or .cts extension. Use an `as` expression instead.
+    export {x};
+==== tests/cases/conformance/node/subfolder2/another/index.cts (3 errors) ====
+    // cjs format file
+    const x = <T>() => <T><any>(void 0);
+               ~
+!!! error TS7060: This syntax is reserved in files with the .mts or .cts extension. Add a trailing comma or explicit constraint.
+                       ~~~~~~~~~~~~~~~~
+!!! error TS7059: This syntax is reserved in files with the .mts or .cts extension. Use an `as` expression instead.
+                          ~~~~~~~~~~~~~
+!!! error TS7059: This syntax is reserved in files with the .mts or .cts extension. Use an `as` expression instead.
+    export {x};
+==== tests/cases/conformance/node/index.mts (3 errors) ====
+    // esm format file
+    const x = <T>() => <T><any>(void 0);
+               ~
+!!! error TS7060: This syntax is reserved in files with the .mts or .cts extension. Add a trailing comma or explicit constraint.
+                       ~~~~~~~~~~~~~~~~
+!!! error TS7059: This syntax is reserved in files with the .mts or .cts extension. Use an `as` expression instead.
+                          ~~~~~~~~~~~~~
+!!! error TS7059: This syntax is reserved in files with the .mts or .cts extension. Use an `as` expression instead.
+    export {x};
+==== tests/cases/conformance/node/index.cts (3 errors) ====
+    // cjs format file
+    const x = <T>() => <T><any>(void 0);
+               ~
+!!! error TS7060: This syntax is reserved in files with the .mts or .cts extension. Add a trailing comma or explicit constraint.
+                       ~~~~~~~~~~~~~~~~
+!!! error TS7059: This syntax is reserved in files with the .mts or .cts extension. Use an `as` expression instead.
+                          ~~~~~~~~~~~~~
+!!! error TS7059: This syntax is reserved in files with the .mts or .cts extension. Use an `as` expression instead.
+    export {x};
+==== tests/cases/conformance/node/index.ts (0 errors) ====
+    // esm format file
+    const x = <T>() => <T><any>(void 0);
+    export {x};
+==== tests/cases/conformance/node/package.json (0 errors) ====
+    {
+        "name": "package",
+        "private": true,
+        "type": "module"
+    }
+==== tests/cases/conformance/node/subfolder/package.json (0 errors) ====
+    {
+        "type": "commonjs"
+    }
+==== tests/cases/conformance/node/subfolder2/package.json (0 errors) ====
+    {
+    }
+==== tests/cases/conformance/node/subfolder2/another/package.json (0 errors) ====
+    {
+        "type": "module"
+    }
\ No newline at end of file
diff --git a/tests/baselines/reference/nodeModulesForbidenSyntax(module=nodenext).js b/tests/baselines/reference/nodeModulesForbidenSyntax(module=nodenext).js
new file mode 100644
index 0000000000000..4cca6af5a58d7
--- /dev/null
+++ b/tests/baselines/reference/nodeModulesForbidenSyntax(module=nodenext).js
@@ -0,0 +1,172 @@
+//// [tests/cases/conformance/node/nodeModulesForbidenSyntax.ts] ////
+
+//// [index.ts]
+// cjs format file
+const x = <T>() => <T><any>(void 0);
+export {x};
+//// [index.cts]
+// cjs format file
+const x = <T>() => <T><any>(void 0);
+export {x};
+//// [index.mts]
+// esm format file
+const x = <T>() => <T><any>(void 0);
+export {x};
+//// [index.ts]
+// cjs format file
+const x = <T>() => <T><any>(void 0);
+export {x};
+//// [index.cts]
+// cjs format file
+const x = <T>() => <T><any>(void 0);
+export {x};
+//// [index.mts]
+// esm format file
+const x = <T>() => <T><any>(void 0);
+export {x};
+//// [index.ts]
+// esm format file
+const x = <T>() => <T><any>(void 0);
+export {x};
+//// [index.mts]
+// esm format file
+const x = <T>() => <T><any>(void 0);
+export {x};
+//// [index.cts]
+// cjs format file
+const x = <T>() => <T><any>(void 0);
+export {x};
+//// [index.mts]
+// esm format file
+const x = <T>() => <T><any>(void 0);
+export {x};
+//// [index.cts]
+// cjs format file
+const x = <T>() => <T><any>(void 0);
+export {x};
+//// [index.ts]
+// esm format file
+const x = <T>() => <T><any>(void 0);
+export {x};
+//// [package.json]
+{
+    "name": "package",
+    "private": true,
+    "type": "module"
+}
+//// [package.json]
+{
+    "type": "commonjs"
+}
+//// [package.json]
+{
+}
+//// [package.json]
+{
+    "type": "module"
+}
+
+//// [index.js]
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.x = void 0;
+// cjs format file
+const x = () => (void 0);
+exports.x = x;
+//// [index.cjs]
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.x = void 0;
+// cjs format file
+const x = () => (void 0);
+exports.x = x;
+//// [index.mjs]
+// esm format file
+const x = () => (void 0);
+export { x };
+//// [index.js]
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.x = void 0;
+// cjs format file
+const x = () => (void 0);
+exports.x = x;
+//// [index.cjs]
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.x = void 0;
+// cjs format file
+const x = () => (void 0);
+exports.x = x;
+//// [index.mjs]
+// esm format file
+const x = () => (void 0);
+export { x };
+//// [index.js]
+// esm format file
+const x = () => (void 0);
+export { x };
+//// [index.mjs]
+// esm format file
+const x = () => (void 0);
+export { x };
+//// [index.cjs]
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.x = void 0;
+// cjs format file
+const x = () => (void 0);
+exports.x = x;
+//// [index.mjs]
+// esm format file
+const x = () => (void 0);
+export { x };
+//// [index.cjs]
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.x = void 0;
+// cjs format file
+const x = () => (void 0);
+exports.x = x;
+//// [index.js]
+// esm format file
+const x = () => (void 0);
+export { x };
+
+
+//// [index.d.ts]
+declare const x: <T>() => T;
+export { x };
+//// [index.d.cts]
+declare const x: <T>() => T;
+export { x };
+//// [index.d.mts]
+declare const x: <T>() => T;
+export { x };
+//// [index.d.ts]
+declare const x: <T>() => T;
+export { x };
+//// [index.d.cts]
+declare const x: <T>() => T;
+export { x };
+//// [index.d.mts]
+declare const x: <T>() => T;
+export { x };
+//// [index.d.ts]
+declare const x: <T>() => T;
+export { x };
+//// [index.d.mts]
+declare const x: <T>() => T;
+export { x };
+//// [index.d.cts]
+declare const x: <T>() => T;
+export { x };
+//// [index.d.mts]
+declare const x: <T>() => T;
+export { x };
+//// [index.d.cts]
+declare const x: <T>() => T;
+export { x };
+//// [index.d.ts]
+declare const x: <T>() => T;
+export { x };
diff --git a/tests/baselines/reference/nodeModulesForbidenSyntax(module=nodenext).symbols b/tests/baselines/reference/nodeModulesForbidenSyntax(module=nodenext).symbols
new file mode 100644
index 0000000000000..1ca35d0d3e32e
--- /dev/null
+++ b/tests/baselines/reference/nodeModulesForbidenSyntax(module=nodenext).symbols
@@ -0,0 +1,120 @@
+=== tests/cases/conformance/node/subfolder/index.ts ===
+// cjs format file
+const x = <T>() => <T><any>(void 0);
+>x : Symbol(x, Decl(index.ts, 1, 5))
+>T : Symbol(T, Decl(index.ts, 1, 11))
+>T : Symbol(T, Decl(index.ts, 1, 11))
+
+export {x};
+>x : Symbol(x, Decl(index.ts, 2, 8))
+
+=== tests/cases/conformance/node/subfolder/index.cts ===
+// cjs format file
+const x = <T>() => <T><any>(void 0);
+>x : Symbol(x, Decl(index.cts, 1, 5))
+>T : Symbol(T, Decl(index.cts, 1, 11))
+>T : Symbol(T, Decl(index.cts, 1, 11))
+
+export {x};
+>x : Symbol(x, Decl(index.cts, 2, 8))
+
+=== tests/cases/conformance/node/subfolder/index.mts ===
+// esm format file
+const x = <T>() => <T><any>(void 0);
+>x : Symbol(x, Decl(index.mts, 1, 5))
+>T : Symbol(T, Decl(index.mts, 1, 11))
+>T : Symbol(T, Decl(index.mts, 1, 11))
+
+export {x};
+>x : Symbol(x, Decl(index.mts, 2, 8))
+
+=== tests/cases/conformance/node/subfolder2/index.ts ===
+// cjs format file
+const x = <T>() => <T><any>(void 0);
+>x : Symbol(x, Decl(index.ts, 1, 5))
+>T : Symbol(T, Decl(index.ts, 1, 11))
+>T : Symbol(T, Decl(index.ts, 1, 11))
+
+export {x};
+>x : Symbol(x, Decl(index.ts, 2, 8))
+
+=== tests/cases/conformance/node/subfolder2/index.cts ===
+// cjs format file
+const x = <T>() => <T><any>(void 0);
+>x : Symbol(x, Decl(index.cts, 1, 5))
+>T : Symbol(T, Decl(index.cts, 1, 11))
+>T : Symbol(T, Decl(index.cts, 1, 11))
+
+export {x};
+>x : Symbol(x, Decl(index.cts, 2, 8))
+
+=== tests/cases/conformance/node/subfolder2/index.mts ===
+// esm format file
+const x = <T>() => <T><any>(void 0);
+>x : Symbol(x, Decl(index.mts, 1, 5))
+>T : Symbol(T, Decl(index.mts, 1, 11))
+>T : Symbol(T, Decl(index.mts, 1, 11))
+
+export {x};
+>x : Symbol(x, Decl(index.mts, 2, 8))
+
+=== tests/cases/conformance/node/subfolder2/another/index.ts ===
+// esm format file
+const x = <T>() => <T><any>(void 0);
+>x : Symbol(x, Decl(index.ts, 1, 5))
+>T : Symbol(T, Decl(index.ts, 1, 11))
+>T : Symbol(T, Decl(index.ts, 1, 11))
+
+export {x};
+>x : Symbol(x, Decl(index.ts, 2, 8))
+
+=== tests/cases/conformance/node/subfolder2/another/index.mts ===
+// esm format file
+const x = <T>() => <T><any>(void 0);
+>x : Symbol(x, Decl(index.mts, 1, 5))
+>T : Symbol(T, Decl(index.mts, 1, 11))
+>T : Symbol(T, Decl(index.mts, 1, 11))
+
+export {x};
+>x : Symbol(x, Decl(index.mts, 2, 8))
+
+=== tests/cases/conformance/node/subfolder2/another/index.cts ===
+// cjs format file
+const x = <T>() => <T><any>(void 0);
+>x : Symbol(x, Decl(index.cts, 1, 5))
+>T : Symbol(T, Decl(index.cts, 1, 11))
+>T : Symbol(T, Decl(index.cts, 1, 11))
+
+export {x};
+>x : Symbol(x, Decl(index.cts, 2, 8))
+
+=== tests/cases/conformance/node/index.mts ===
+// esm format file
+const x = <T>() => <T><any>(void 0);
+>x : Symbol(x, Decl(index.mts, 1, 5))
+>T : Symbol(T, Decl(index.mts, 1, 11))
+>T : Symbol(T, Decl(index.mts, 1, 11))
+
+export {x};
+>x : Symbol(x, Decl(index.mts, 2, 8))
+
+=== tests/cases/conformance/node/index.cts ===
+// cjs format file
+const x = <T>() => <T><any>(void 0);
+>x : Symbol(x, Decl(index.cts, 1, 5))
+>T : Symbol(T, Decl(index.cts, 1, 11))
+>T : Symbol(T, Decl(index.cts, 1, 11))
+
+export {x};
+>x : Symbol(x, Decl(index.cts, 2, 8))
+
+=== tests/cases/conformance/node/index.ts ===
+// esm format file
+const x = <T>() => <T><any>(void 0);
+>x : Symbol(x, Decl(index.ts, 1, 5))
+>T : Symbol(T, Decl(index.ts, 1, 11))
+>T : Symbol(T, Decl(index.ts, 1, 11))
+
+export {x};
+>x : Symbol(x, Decl(index.ts, 2, 8))
+
diff --git a/tests/baselines/reference/nodeModulesForbidenSyntax(module=nodenext).types b/tests/baselines/reference/nodeModulesForbidenSyntax(module=nodenext).types
new file mode 100644
index 0000000000000..016af4314d16b
--- /dev/null
+++ b/tests/baselines/reference/nodeModulesForbidenSyntax(module=nodenext).types
@@ -0,0 +1,168 @@
+=== tests/cases/conformance/node/subfolder/index.ts ===
+// cjs format file
+const x = <T>() => <T><any>(void 0);
+>x : <T>() => T
+><T>() => <T><any>(void 0) : <T>() => T
+><T><any>(void 0) : T
+><any>(void 0) : any
+>(void 0) : undefined
+>void 0 : undefined
+>0 : 0
+
+export {x};
+>x : <T>() => T
+
+=== tests/cases/conformance/node/subfolder/index.cts ===
+// cjs format file
+const x = <T>() => <T><any>(void 0);
+>x : <T>() => T
+><T>() => <T><any>(void 0) : <T>() => T
+><T><any>(void 0) : T
+><any>(void 0) : any
+>(void 0) : undefined
+>void 0 : undefined
+>0 : 0
+
+export {x};
+>x : <T>() => T
+
+=== tests/cases/conformance/node/subfolder/index.mts ===
+// esm format file
+const x = <T>() => <T><any>(void 0);
+>x : <T>() => T
+><T>() => <T><any>(void 0) : <T>() => T
+><T><any>(void 0) : T
+><any>(void 0) : any
+>(void 0) : undefined
+>void 0 : undefined
+>0 : 0
+
+export {x};
+>x : <T>() => T
+
+=== tests/cases/conformance/node/subfolder2/index.ts ===
+// cjs format file
+const x = <T>() => <T><any>(void 0);
+>x : <T>() => T
+><T>() => <T><any>(void 0) : <T>() => T
+><T><any>(void 0) : T
+><any>(void 0) : any
+>(void 0) : undefined
+>void 0 : undefined
+>0 : 0
+
+export {x};
+>x : <T>() => T
+
+=== tests/cases/conformance/node/subfolder2/index.cts ===
+// cjs format file
+const x = <T>() => <T><any>(void 0);
+>x : <T>() => T
+><T>() => <T><any>(void 0) : <T>() => T
+><T><any>(void 0) : T
+><any>(void 0) : any
+>(void 0) : undefined
+>void 0 : undefined
+>0 : 0
+
+export {x};
+>x : <T>() => T
+
+=== tests/cases/conformance/node/subfolder2/index.mts ===
+// esm format file
+const x = <T>() => <T><any>(void 0);
+>x : <T>() => T
+><T>() => <T><any>(void 0) : <T>() => T
+><T><any>(void 0) : T
+><any>(void 0) : any
+>(void 0) : undefined
+>void 0 : undefined
+>0 : 0
+
+export {x};
+>x : <T>() => T
+
+=== tests/cases/conformance/node/subfolder2/another/index.ts ===
+// esm format file
+const x = <T>() => <T><any>(void 0);
+>x : <T>() => T
+><T>() => <T><any>(void 0) : <T>() => T
+><T><any>(void 0) : T
+><any>(void 0) : any
+>(void 0) : undefined
+>void 0 : undefined
+>0 : 0
+
+export {x};
+>x : <T>() => T
+
+=== tests/cases/conformance/node/subfolder2/another/index.mts ===
+// esm format file
+const x = <T>() => <T><any>(void 0);
+>x : <T>() => T
+><T>() => <T><any>(void 0) : <T>() => T
+><T><any>(void 0) : T
+><any>(void 0) : any
+>(void 0) : undefined
+>void 0 : undefined
+>0 : 0
+
+export {x};
+>x : <T>() => T
+
+=== tests/cases/conformance/node/subfolder2/another/index.cts ===
+// cjs format file
+const x = <T>() => <T><any>(void 0);
+>x : <T>() => T
+><T>() => <T><any>(void 0) : <T>() => T
+><T><any>(void 0) : T
+><any>(void 0) : any
+>(void 0) : undefined
+>void 0 : undefined
+>0 : 0
+
+export {x};
+>x : <T>() => T
+
+=== tests/cases/conformance/node/index.mts ===
+// esm format file
+const x = <T>() => <T><any>(void 0);
+>x : <T>() => T
+><T>() => <T><any>(void 0) : <T>() => T
+><T><any>(void 0) : T
+><any>(void 0) : any
+>(void 0) : undefined
+>void 0 : undefined
+>0 : 0
+
+export {x};
+>x : <T>() => T
+
+=== tests/cases/conformance/node/index.cts ===
+// cjs format file
+const x = <T>() => <T><any>(void 0);
+>x : <T>() => T
+><T>() => <T><any>(void 0) : <T>() => T
+><T><any>(void 0) : T
+><any>(void 0) : any
+>(void 0) : undefined
+>void 0 : undefined
+>0 : 0
+
+export {x};
+>x : <T>() => T
+
+=== tests/cases/conformance/node/index.ts ===
+// esm format file
+const x = <T>() => <T><any>(void 0);
+>x : <T>() => T
+><T>() => <T><any>(void 0) : <T>() => T
+><T><any>(void 0) : T
+><any>(void 0) : any
+>(void 0) : undefined
+>void 0 : undefined
+>0 : 0
+
+export {x};
+>x : <T>() => T
+
diff --git a/tests/baselines/reference/project/invalidRootFile/amd/invalidRootFile.errors.txt b/tests/baselines/reference/project/invalidRootFile/amd/invalidRootFile.errors.txt
index 071a8c6b528bc..ce9c2a81f90ee 100644
--- a/tests/baselines/reference/project/invalidRootFile/amd/invalidRootFile.errors.txt
+++ b/tests/baselines/reference/project/invalidRootFile/amd/invalidRootFile.errors.txt
@@ -1,10 +1,10 @@
 error TS6053: File 'a.ts' not found.
   The file is in the program because:
     Root file specified for compilation
-error TS6054: File 'a.t' has an unsupported extension. The only supported extensions are '.ts', '.tsx', '.d.ts'.
+error TS6054: File 'a.t' has an unsupported extension. The only supported extensions are '.ts', '.tsx', '.d.ts', '.cts', '.d.cts', '.mts', '.d.mts'.
   The file is in the program because:
     Root file specified for compilation
-error TS6231: Could not resolve the path 'a' with the extensions: '.ts', '.tsx', '.d.ts'.
+error TS6231: Could not resolve the path 'a' with the extensions: '.ts', '.tsx', '.d.ts', '.cts', '.d.cts', '.mts', '.d.mts'.
   The file is in the program because:
     Root file specified for compilation
 
@@ -12,9 +12,9 @@ error TS6231: Could not resolve the path 'a' with the extensions: '.ts', '.tsx',
 !!! error TS6053: File 'a.ts' not found.
 !!! error TS6053:   The file is in the program because:
 !!! error TS6053:     Root file specified for compilation
-!!! error TS6054: File 'a.t' has an unsupported extension. The only supported extensions are '.ts', '.tsx', '.d.ts'.
+!!! error TS6054: File 'a.t' has an unsupported extension. The only supported extensions are '.ts', '.tsx', '.d.ts', '.cts', '.d.cts', '.mts', '.d.mts'.
 !!! error TS6054:   The file is in the program because:
 !!! error TS6054:     Root file specified for compilation
-!!! error TS6231: Could not resolve the path 'a' with the extensions: '.ts', '.tsx', '.d.ts'.
+!!! error TS6231: Could not resolve the path 'a' with the extensions: '.ts', '.tsx', '.d.ts', '.cts', '.d.cts', '.mts', '.d.mts'.
 !!! error TS6231:   The file is in the program because:
 !!! error TS6231:     Root file specified for compilation
\ No newline at end of file
diff --git a/tests/baselines/reference/project/invalidRootFile/node/invalidRootFile.errors.txt b/tests/baselines/reference/project/invalidRootFile/node/invalidRootFile.errors.txt
index 071a8c6b528bc..ce9c2a81f90ee 100644
--- a/tests/baselines/reference/project/invalidRootFile/node/invalidRootFile.errors.txt
+++ b/tests/baselines/reference/project/invalidRootFile/node/invalidRootFile.errors.txt
@@ -1,10 +1,10 @@
 error TS6053: File 'a.ts' not found.
   The file is in the program because:
     Root file specified for compilation
-error TS6054: File 'a.t' has an unsupported extension. The only supported extensions are '.ts', '.tsx', '.d.ts'.
+error TS6054: File 'a.t' has an unsupported extension. The only supported extensions are '.ts', '.tsx', '.d.ts', '.cts', '.d.cts', '.mts', '.d.mts'.
   The file is in the program because:
     Root file specified for compilation
-error TS6231: Could not resolve the path 'a' with the extensions: '.ts', '.tsx', '.d.ts'.
+error TS6231: Could not resolve the path 'a' with the extensions: '.ts', '.tsx', '.d.ts', '.cts', '.d.cts', '.mts', '.d.mts'.
   The file is in the program because:
     Root file specified for compilation
 
@@ -12,9 +12,9 @@ error TS6231: Could not resolve the path 'a' with the extensions: '.ts', '.tsx',
 !!! error TS6053: File 'a.ts' not found.
 !!! error TS6053:   The file is in the program because:
 !!! error TS6053:     Root file specified for compilation
-!!! error TS6054: File 'a.t' has an unsupported extension. The only supported extensions are '.ts', '.tsx', '.d.ts'.
+!!! error TS6054: File 'a.t' has an unsupported extension. The only supported extensions are '.ts', '.tsx', '.d.ts', '.cts', '.d.cts', '.mts', '.d.mts'.
 !!! error TS6054:   The file is in the program because:
 !!! error TS6054:     Root file specified for compilation
-!!! error TS6231: Could not resolve the path 'a' with the extensions: '.ts', '.tsx', '.d.ts'.
+!!! error TS6231: Could not resolve the path 'a' with the extensions: '.ts', '.tsx', '.d.ts', '.cts', '.d.cts', '.mts', '.d.mts'.
 !!! error TS6231:   The file is in the program because:
 !!! error TS6231:     Root file specified for compilation
\ No newline at end of file
diff --git a/tests/baselines/reference/tsbuild/watchMode/moduleResolution/resolves-specifier-in-output-declaration-file-from-referenced-project-correctly-with-cts-and-mts-extensions.js b/tests/baselines/reference/tsbuild/watchMode/moduleResolution/resolves-specifier-in-output-declaration-file-from-referenced-project-correctly-with-cts-and-mts-extensions.js
new file mode 100644
index 0000000000000..6a2a409b814cf
--- /dev/null
+++ b/tests/baselines/reference/tsbuild/watchMode/moduleResolution/resolves-specifier-in-output-declaration-file-from-referenced-project-correctly-with-cts-and-mts-extensions.js
@@ -0,0 +1,784 @@
+Input::
+//// [/user/username/projects/myproject/packages/pkg1/package.json]
+{"name":"pkg1","version":"1.0.0","main":"build/index.js","type":"module"}
+
+//// [/user/username/projects/myproject/packages/pkg1/index.ts]
+import type { TheNum } from 'pkg2'
+export const theNum: TheNum = 42;
+
+//// [/user/username/projects/myproject/packages/pkg1/tsconfig.json]
+{"compilerOptions":{"outDir":"build","module":"node12"},"references":[{"path":"../pkg2"}]}
+
+//// [/user/username/projects/myproject/packages/pkg2/const.cts]
+export type TheNum = 42;
+
+//// [/user/username/projects/myproject/packages/pkg2/index.ts]
+export type { TheNum } from './const.cjs';
+
+//// [/user/username/projects/myproject/packages/pkg2/tsconfig.json]
+{"compilerOptions":{"composite":true,"outDir":"build","module":"node12"}}
+
+//// [/user/username/projects/myproject/packages/pkg2/package.json]
+{"name":"pkg2","version":"1.0.0","main":"build/index.js","type":"module"}
+
+//// [/user/username/projects/myproject/node_modules/pkg2] symlink(/user/username/projects/myproject/packages/pkg2)
+//// [/a/lib/lib.es2020.full.d.ts]
+/// <reference no-default-lib="true"/>
+interface Boolean {}
+interface Function {}
+interface CallableFunction {}
+interface NewableFunction {}
+interface IArguments {}
+interface Number { toExponential: any; }
+interface Object {}
+interface RegExp {}
+interface String { charAt: any; }
+interface Array<T> { length: number; [n: number]: T; }
+
+
+/a/lib/tsc.js -b packages/pkg1 -w --verbose --traceResolution
+Output::
+>> Screen clear
+[12:00:41 AM] Starting compilation in watch mode...
+
+[12:00:42 AM] Projects in this build: 
+    * packages/pkg2/tsconfig.json
+    * packages/pkg1/tsconfig.json
+
+[12:00:43 AM] Project 'packages/pkg2/tsconfig.json' is out of date because output file 'packages/pkg2/build/const.cjs' does not exist
+
+[12:00:44 AM] Building project '/user/username/projects/myproject/packages/pkg2/tsconfig.json'...
+
+Found 'package.json' at '/user/username/projects/myproject/packages/pkg2/package.json'.
+'package.json' does not have a 'typesVersions' field.
+======== Resolving module './const.cjs' from '/user/username/projects/myproject/packages/pkg2/index.ts'. ========
+Module resolution kind is not specified, using 'Node12'.
+Loading module as file / folder, candidate module location '/user/username/projects/myproject/packages/pkg2/const.cjs', target file type 'TypeScript'.
+File '/user/username/projects/myproject/packages/pkg2/const.cjs.ts' does not exist.
+File '/user/username/projects/myproject/packages/pkg2/const.cjs.tsx' does not exist.
+File '/user/username/projects/myproject/packages/pkg2/const.cjs.d.ts' does not exist.
+File name '/user/username/projects/myproject/packages/pkg2/const.cjs' has a '.cjs' extension - stripping it.
+File '/user/username/projects/myproject/packages/pkg2/const.cts' exist - use it as a name resolution result.
+======== Module name './const.cjs' was successfully resolved to '/user/username/projects/myproject/packages/pkg2/const.cts'. ========
+File '/a/lib/package.json' does not exist.
+File '/a/package.json' does not exist.
+File '/package.json' does not exist.
+[12:01:00 AM] Project 'packages/pkg1/tsconfig.json' is out of date because output file 'packages/pkg1/build/index.js' does not exist
+
+[12:01:01 AM] Building project '/user/username/projects/myproject/packages/pkg1/tsconfig.json'...
+
+Found 'package.json' at '/user/username/projects/myproject/packages/pkg1/package.json'.
+'package.json' does not have a 'typesVersions' field.
+======== Resolving module 'pkg2' from '/user/username/projects/myproject/packages/pkg1/index.ts'. ========
+Module resolution kind is not specified, using 'Node12'.
+Loading module 'pkg2' from 'node_modules' folder, target file type 'TypeScript'.
+Directory '/user/username/projects/myproject/packages/pkg1/node_modules' does not exist, skipping all lookups in it.
+Directory '/user/username/projects/myproject/packages/node_modules' does not exist, skipping all lookups in it.
+Found 'package.json' at '/user/username/projects/myproject/node_modules/pkg2/package.json'.
+'package.json' does not have a 'typesVersions' field.
+File '/user/username/projects/myproject/node_modules/pkg2.ts' does not exist.
+File '/user/username/projects/myproject/node_modules/pkg2.tsx' does not exist.
+File '/user/username/projects/myproject/node_modules/pkg2.d.ts' does not exist.
+'package.json' does not have a 'typings' field.
+'package.json' does not have a 'types' field.
+'package.json' has 'main' field 'build/index.js' that references '/user/username/projects/myproject/node_modules/pkg2/build/index.js'.
+File '/user/username/projects/myproject/node_modules/pkg2/build/index.js' exist - use it as a name resolution result.
+File '/user/username/projects/myproject/node_modules/pkg2/build/index.js' has an unsupported extension, so skipping it.
+Loading module as file / folder, candidate module location '/user/username/projects/myproject/node_modules/pkg2/build/index.js', target file type 'TypeScript'.
+File '/user/username/projects/myproject/node_modules/pkg2/build/index.js.ts' does not exist.
+File '/user/username/projects/myproject/node_modules/pkg2/build/index.js.tsx' does not exist.
+File '/user/username/projects/myproject/node_modules/pkg2/build/index.js.d.ts' does not exist.
+File name '/user/username/projects/myproject/node_modules/pkg2/build/index.js' has a '.js' extension - stripping it.
+File '/user/username/projects/myproject/node_modules/pkg2/build/index.ts' does not exist.
+File '/user/username/projects/myproject/node_modules/pkg2/build/index.tsx' does not exist.
+File '/user/username/projects/myproject/node_modules/pkg2/build/index.d.ts' exist - use it as a name resolution result.
+Resolving real path for '/user/username/projects/myproject/node_modules/pkg2/build/index.d.ts', result '/user/username/projects/myproject/packages/pkg2/build/index.d.ts'.
+======== Module name 'pkg2' was successfully resolved to '/user/username/projects/myproject/packages/pkg2/build/index.d.ts' with Package ID 'pkg2/build/index.d.ts@1.0.0'. ========
+File '/user/username/projects/myproject/packages/pkg2/build/package.json' does not exist.
+File '/user/username/projects/myproject/packages/pkg2/package.json' exists according to earlier cached lookups.
+======== Resolving module './const.cjs' from '/user/username/projects/myproject/packages/pkg2/build/index.d.ts'. ========
+Using compiler options of project reference redirect '/user/username/projects/myproject/packages/pkg2/tsconfig.json'.
+Module resolution kind is not specified, using 'Node12'.
+Loading module as file / folder, candidate module location '/user/username/projects/myproject/packages/pkg2/build/const.cjs', target file type 'TypeScript'.
+File '/user/username/projects/myproject/packages/pkg2/build/const.cjs.ts' does not exist.
+File '/user/username/projects/myproject/packages/pkg2/build/const.cjs.tsx' does not exist.
+File '/user/username/projects/myproject/packages/pkg2/build/const.cjs.d.ts' does not exist.
+File name '/user/username/projects/myproject/packages/pkg2/build/const.cjs' has a '.cjs' extension - stripping it.
+File '/user/username/projects/myproject/packages/pkg2/build/const.cts' does not exist.
+File '/user/username/projects/myproject/packages/pkg2/build/const.d.cts' exist - use it as a name resolution result.
+======== Module name './const.cjs' was successfully resolved to '/user/username/projects/myproject/packages/pkg2/build/const.d.cts'. ========
+File '/a/lib/package.json' does not exist according to earlier cached lookups.
+File '/a/package.json' does not exist according to earlier cached lookups.
+File '/package.json' does not exist according to earlier cached lookups.
+[12:01:07 AM] Found 0 errors. Watching for file changes.
+
+
+
+Program root files: ["/user/username/projects/myproject/packages/pkg2/const.cts","/user/username/projects/myproject/packages/pkg2/index.ts"]
+Program options: {"composite":true,"outDir":"/user/username/projects/myproject/packages/pkg2/build","module":100,"watch":true,"traceResolution":true,"configFilePath":"/user/username/projects/myproject/packages/pkg2/tsconfig.json"}
+Program structureReused: Not
+Program files::
+/a/lib/lib.es2020.full.d.ts
+/user/username/projects/myproject/packages/pkg2/const.cts
+/user/username/projects/myproject/packages/pkg2/index.ts
+
+Semantic diagnostics in builder refreshed for::
+/a/lib/lib.es2020.full.d.ts
+/user/username/projects/myproject/packages/pkg2/const.cts
+/user/username/projects/myproject/packages/pkg2/index.ts
+
+Shape signatures in builder refreshed for::
+/a/lib/lib.es2020.full.d.ts (used version)
+/user/username/projects/myproject/packages/pkg2/const.cts (used version)
+/user/username/projects/myproject/packages/pkg2/index.ts (used version)
+
+Program root files: ["/user/username/projects/myproject/packages/pkg1/index.ts"]
+Program options: {"outDir":"/user/username/projects/myproject/packages/pkg1/build","module":100,"watch":true,"traceResolution":true,"configFilePath":"/user/username/projects/myproject/packages/pkg1/tsconfig.json"}
+Program structureReused: Not
+Program files::
+/a/lib/lib.es2020.full.d.ts
+/user/username/projects/myproject/packages/pkg2/build/index.d.ts
+/user/username/projects/myproject/packages/pkg1/index.ts
+
+Semantic diagnostics in builder refreshed for::
+/a/lib/lib.es2020.full.d.ts
+/user/username/projects/myproject/packages/pkg2/build/index.d.ts
+/user/username/projects/myproject/packages/pkg1/index.ts
+
+Shape signatures in builder refreshed for::
+/a/lib/lib.es2020.full.d.ts (used version)
+/user/username/projects/myproject/packages/pkg2/build/index.d.ts (used version)
+/user/username/projects/myproject/packages/pkg1/index.ts (used version)
+
+WatchedFiles::
+/user/username/projects/myproject/packages/pkg2/tsconfig.json:
+  {"fileName":"/user/username/projects/myproject/packages/pkg2/tsconfig.json","pollingInterval":250}
+/user/username/projects/myproject/packages/pkg2/const.cts:
+  {"fileName":"/user/username/projects/myproject/packages/pkg2/const.cts","pollingInterval":250}
+/user/username/projects/myproject/packages/pkg2/index.ts:
+  {"fileName":"/user/username/projects/myproject/packages/pkg2/index.ts","pollingInterval":250}
+/user/username/projects/myproject/packages/pkg2/package.json:
+  {"fileName":"/user/username/projects/myproject/packages/pkg2/package.json","pollingInterval":250}
+  {"fileName":"/user/username/projects/myproject/packages/pkg2/package.json","pollingInterval":250}
+/a/lib/package.json:
+  {"fileName":"/a/lib/package.json","pollingInterval":250}
+  {"fileName":"/a/lib/package.json","pollingInterval":250}
+/a/package.json:
+  {"fileName":"/a/package.json","pollingInterval":250}
+  {"fileName":"/a/package.json","pollingInterval":250}
+/package.json:
+  {"fileName":"/package.json","pollingInterval":250}
+  {"fileName":"/package.json","pollingInterval":250}
+/user/username/projects/myproject/packages/pkg1/tsconfig.json:
+  {"fileName":"/user/username/projects/myproject/packages/pkg1/tsconfig.json","pollingInterval":250}
+/user/username/projects/myproject/packages/pkg1/index.ts:
+  {"fileName":"/user/username/projects/myproject/packages/pkg1/index.ts","pollingInterval":250}
+/user/username/projects/myproject/packages/pkg1/package.json:
+  {"fileName":"/user/username/projects/myproject/packages/pkg1/package.json","pollingInterval":250}
+/user/username/projects/myproject/packages/pkg2/build/package.json:
+  {"fileName":"/user/username/projects/myproject/packages/pkg2/build/package.json","pollingInterval":250}
+
+FsWatches::
+
+FsWatchesRecursive::
+/user/username/projects/myproject/packages/pkg2:
+  {"directoryName":"/user/username/projects/myproject/packages/pkg2","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}}
+/user/username/projects/myproject/packages/pkg1:
+  {"directoryName":"/user/username/projects/myproject/packages/pkg1","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}}
+
+exitCode:: ExitStatus.undefined
+
+//// [/user/username/projects/myproject/packages/pkg2/build/const.cjs]
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+
+
+//// [/user/username/projects/myproject/packages/pkg2/build/const.d.cts]
+export declare type TheNum = 42;
+
+
+//// [/user/username/projects/myproject/packages/pkg2/build/index.js]
+export {};
+
+
+//// [/user/username/projects/myproject/packages/pkg2/build/index.d.ts]
+export type { TheNum } from './const.cjs';
+
+
+//// [/user/username/projects/myproject/packages/pkg2/build/tsconfig.tsbuildinfo]
+{"program":{"fileNames":["../../../../../../../a/lib/lib.es2020.full.d.ts","../const.cts","../index.ts"],"fileInfos":[{"version":"-7698705165-/// <reference no-default-lib=\"true\"/>\ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array<T> { length: number; [n: number]: T; }","affectsGlobalScope":true,"impliedFormat":1},"-11202312776-export type TheNum = 42;","-9668872159-export type { TheNum } from './const.cjs';"],"options":{"composite":true,"module":100,"outDir":"./"},"fileIdsList":[[2]],"referencedMap":[[3,1]],"exportedModulesMap":[[3,1]],"semanticDiagnosticsPerFile":[1,2,3]},"version":"FakeTSVersion"}
+
+//// [/user/username/projects/myproject/packages/pkg2/build/tsconfig.tsbuildinfo.readable.baseline.txt]
+{
+  "program": {
+    "fileNames": [
+      "../../../../../../../a/lib/lib.es2020.full.d.ts",
+      "../const.cts",
+      "../index.ts"
+    ],
+    "fileNamesList": [
+      [
+        "../const.cts"
+      ]
+    ],
+    "fileInfos": {
+      "../../../../../../../a/lib/lib.es2020.full.d.ts": {
+        "version": "-7698705165-/// <reference no-default-lib=\"true\"/>\ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array<T> { length: number; [n: number]: T; }",
+        "signature": "-7698705165-/// <reference no-default-lib=\"true\"/>\ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array<T> { length: number; [n: number]: T; }",
+        "affectsGlobalScope": true,
+        "impliedFormat": 1
+      },
+      "../const.cts": {
+        "version": "-11202312776-export type TheNum = 42;",
+        "signature": "-11202312776-export type TheNum = 42;"
+      },
+      "../index.ts": {
+        "version": "-9668872159-export type { TheNum } from './const.cjs';",
+        "signature": "-9668872159-export type { TheNum } from './const.cjs';"
+      }
+    },
+    "options": {
+      "composite": true,
+      "module": 100,
+      "outDir": "./"
+    },
+    "referencedMap": {
+      "../index.ts": [
+        "../const.cts"
+      ]
+    },
+    "exportedModulesMap": {
+      "../index.ts": [
+        "../const.cts"
+      ]
+    },
+    "semanticDiagnosticsPerFile": [
+      "../../../../../../../a/lib/lib.es2020.full.d.ts",
+      "../const.cts",
+      "../index.ts"
+    ]
+  },
+  "version": "FakeTSVersion",
+  "size": 826
+}
+
+//// [/user/username/projects/myproject/packages/pkg1/build/index.js]
+export const theNum = 42;
+
+
+
+Change:: reports import errors after change to package file
+
+Input::
+//// [/user/username/projects/myproject/packages/pkg1/package.json]
+{"name":"pkg1","version":"1.0.0","main":"build/index.js","type":"commonjs"}
+
+
+Output::
+>> Screen clear
+[12:01:11 AM] File change detected. Starting incremental compilation...
+
+[12:01:12 AM] Project 'packages/pkg1/tsconfig.json' is out of date because oldest output 'packages/pkg1/build/index.js' is older than newest input 'packages/pkg2'
+
+[12:01:13 AM] Building project '/user/username/projects/myproject/packages/pkg1/tsconfig.json'...
+
+Found 'package.json' at '/user/username/projects/myproject/packages/pkg1/package.json'.
+'package.json' does not have a 'typesVersions' field.
+======== Resolving module 'pkg2' from '/user/username/projects/myproject/packages/pkg1/index.ts'. ========
+Module resolution kind is not specified, using 'Node12'.
+Loading module 'pkg2' from 'node_modules' folder, target file type 'TypeScript'.
+Directory '/user/username/projects/myproject/packages/pkg1/node_modules' does not exist, skipping all lookups in it.
+Directory '/user/username/projects/myproject/packages/node_modules' does not exist, skipping all lookups in it.
+Found 'package.json' at '/user/username/projects/myproject/node_modules/pkg2/package.json'.
+'package.json' does not have a 'typesVersions' field.
+File '/user/username/projects/myproject/node_modules/pkg2.ts' does not exist.
+File '/user/username/projects/myproject/node_modules/pkg2.tsx' does not exist.
+File '/user/username/projects/myproject/node_modules/pkg2.d.ts' does not exist.
+'package.json' does not have a 'typings' field.
+'package.json' does not have a 'types' field.
+'package.json' has 'main' field 'build/index.js' that references '/user/username/projects/myproject/node_modules/pkg2/build/index.js'.
+File '/user/username/projects/myproject/node_modules/pkg2/build/index.js' exist - use it as a name resolution result.
+File '/user/username/projects/myproject/node_modules/pkg2/build/index.js' has an unsupported extension, so skipping it.
+Loading module as file / folder, candidate module location '/user/username/projects/myproject/node_modules/pkg2/build/index.js', target file type 'TypeScript'.
+File '/user/username/projects/myproject/node_modules/pkg2/build/index.js.ts' does not exist.
+File '/user/username/projects/myproject/node_modules/pkg2/build/index.js.tsx' does not exist.
+File '/user/username/projects/myproject/node_modules/pkg2/build/index.js.d.ts' does not exist.
+File name '/user/username/projects/myproject/node_modules/pkg2/build/index.js' has a '.js' extension - stripping it.
+File '/user/username/projects/myproject/node_modules/pkg2/build/index.ts' does not exist.
+File '/user/username/projects/myproject/node_modules/pkg2/build/index.tsx' does not exist.
+File '/user/username/projects/myproject/node_modules/pkg2/build/index.d.ts' exist - use it as a name resolution result.
+Resolving real path for '/user/username/projects/myproject/node_modules/pkg2/build/index.d.ts', result '/user/username/projects/myproject/packages/pkg2/build/index.d.ts'.
+======== Module name 'pkg2' was successfully resolved to '/user/username/projects/myproject/packages/pkg2/build/index.d.ts' with Package ID 'pkg2/build/index.d.ts@1.0.0'. ========
+File '/user/username/projects/myproject/packages/pkg2/build/package.json' does not exist.
+Found 'package.json' at '/user/username/projects/myproject/packages/pkg2/package.json'.
+'package.json' does not have a 'typesVersions' field.
+======== Resolving module './const.cjs' from '/user/username/projects/myproject/packages/pkg2/build/index.d.ts'. ========
+Using compiler options of project reference redirect '/user/username/projects/myproject/packages/pkg2/tsconfig.json'.
+Module resolution kind is not specified, using 'Node12'.
+Loading module as file / folder, candidate module location '/user/username/projects/myproject/packages/pkg2/build/const.cjs', target file type 'TypeScript'.
+File '/user/username/projects/myproject/packages/pkg2/build/const.cjs.ts' does not exist.
+File '/user/username/projects/myproject/packages/pkg2/build/const.cjs.tsx' does not exist.
+File '/user/username/projects/myproject/packages/pkg2/build/const.cjs.d.ts' does not exist.
+File name '/user/username/projects/myproject/packages/pkg2/build/const.cjs' has a '.cjs' extension - stripping it.
+File '/user/username/projects/myproject/packages/pkg2/build/const.cts' does not exist.
+File '/user/username/projects/myproject/packages/pkg2/build/const.d.cts' exist - use it as a name resolution result.
+======== Module name './const.cjs' was successfully resolved to '/user/username/projects/myproject/packages/pkg2/build/const.d.cts'. ========
+File '/a/lib/package.json' does not exist.
+File '/a/package.json' does not exist.
+File '/package.json' does not exist.
+packages/pkg1/index.ts:1:29 - error TS1471: Module 'pkg2' cannot be imported using this construct. The specifier only resolves to an es module, which cannot be imported synchronously. Use dynamic import instead.
+
+1 import type { TheNum } from 'pkg2'
+                              ~~~~~~
+
+[12:01:14 AM] Found 1 error. Watching for file changes.
+
+
+
+Program root files: ["/user/username/projects/myproject/packages/pkg1/index.ts"]
+Program options: {"outDir":"/user/username/projects/myproject/packages/pkg1/build","module":100,"watch":true,"traceResolution":true,"configFilePath":"/user/username/projects/myproject/packages/pkg1/tsconfig.json"}
+Program structureReused: Not
+Program files::
+/a/lib/lib.es2020.full.d.ts
+/user/username/projects/myproject/packages/pkg2/build/index.d.ts
+/user/username/projects/myproject/packages/pkg1/index.ts
+
+Semantic diagnostics in builder refreshed for::
+/user/username/projects/myproject/packages/pkg1/index.ts
+
+Shape signatures in builder refreshed for::
+/user/username/projects/myproject/packages/pkg1/index.ts (computed .d.ts)
+
+WatchedFiles::
+/user/username/projects/myproject/packages/pkg2/tsconfig.json:
+  {"fileName":"/user/username/projects/myproject/packages/pkg2/tsconfig.json","pollingInterval":250}
+/user/username/projects/myproject/packages/pkg2/const.cts:
+  {"fileName":"/user/username/projects/myproject/packages/pkg2/const.cts","pollingInterval":250}
+/user/username/projects/myproject/packages/pkg2/index.ts:
+  {"fileName":"/user/username/projects/myproject/packages/pkg2/index.ts","pollingInterval":250}
+/user/username/projects/myproject/packages/pkg2/package.json:
+  {"fileName":"/user/username/projects/myproject/packages/pkg2/package.json","pollingInterval":250}
+  {"fileName":"/user/username/projects/myproject/packages/pkg2/package.json","pollingInterval":250}
+/a/lib/package.json:
+  {"fileName":"/a/lib/package.json","pollingInterval":250}
+  {"fileName":"/a/lib/package.json","pollingInterval":250}
+/a/package.json:
+  {"fileName":"/a/package.json","pollingInterval":250}
+  {"fileName":"/a/package.json","pollingInterval":250}
+/package.json:
+  {"fileName":"/package.json","pollingInterval":250}
+  {"fileName":"/package.json","pollingInterval":250}
+/user/username/projects/myproject/packages/pkg1/tsconfig.json:
+  {"fileName":"/user/username/projects/myproject/packages/pkg1/tsconfig.json","pollingInterval":250}
+/user/username/projects/myproject/packages/pkg1/index.ts:
+  {"fileName":"/user/username/projects/myproject/packages/pkg1/index.ts","pollingInterval":250}
+/user/username/projects/myproject/packages/pkg1/package.json:
+  {"fileName":"/user/username/projects/myproject/packages/pkg1/package.json","pollingInterval":250}
+/user/username/projects/myproject/packages/pkg2/build/package.json:
+  {"fileName":"/user/username/projects/myproject/packages/pkg2/build/package.json","pollingInterval":250}
+
+FsWatches::
+
+FsWatchesRecursive::
+/user/username/projects/myproject/packages/pkg2:
+  {"directoryName":"/user/username/projects/myproject/packages/pkg2","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}}
+/user/username/projects/myproject/packages/pkg1:
+  {"directoryName":"/user/username/projects/myproject/packages/pkg1","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}}
+
+exitCode:: ExitStatus.undefined
+
+
+Change:: removes those errors when a package file is changed back
+
+Input::
+//// [/user/username/projects/myproject/packages/pkg1/package.json]
+{"name":"pkg1","version":"1.0.0","main":"build/index.js","type":"module"}
+
+
+Output::
+>> Screen clear
+[12:01:18 AM] File change detected. Starting incremental compilation...
+
+[12:01:19 AM] Project 'packages/pkg1/tsconfig.json' is out of date because oldest output 'packages/pkg1/build/index.js' is older than newest input 'packages/pkg2'
+
+[12:01:20 AM] Building project '/user/username/projects/myproject/packages/pkg1/tsconfig.json'...
+
+Found 'package.json' at '/user/username/projects/myproject/packages/pkg1/package.json'.
+'package.json' does not have a 'typesVersions' field.
+======== Resolving module 'pkg2' from '/user/username/projects/myproject/packages/pkg1/index.ts'. ========
+Module resolution kind is not specified, using 'Node12'.
+Loading module 'pkg2' from 'node_modules' folder, target file type 'TypeScript'.
+Directory '/user/username/projects/myproject/packages/pkg1/node_modules' does not exist, skipping all lookups in it.
+Directory '/user/username/projects/myproject/packages/node_modules' does not exist, skipping all lookups in it.
+Found 'package.json' at '/user/username/projects/myproject/node_modules/pkg2/package.json'.
+'package.json' does not have a 'typesVersions' field.
+File '/user/username/projects/myproject/node_modules/pkg2.ts' does not exist.
+File '/user/username/projects/myproject/node_modules/pkg2.tsx' does not exist.
+File '/user/username/projects/myproject/node_modules/pkg2.d.ts' does not exist.
+'package.json' does not have a 'typings' field.
+'package.json' does not have a 'types' field.
+'package.json' has 'main' field 'build/index.js' that references '/user/username/projects/myproject/node_modules/pkg2/build/index.js'.
+File '/user/username/projects/myproject/node_modules/pkg2/build/index.js' exist - use it as a name resolution result.
+File '/user/username/projects/myproject/node_modules/pkg2/build/index.js' has an unsupported extension, so skipping it.
+Loading module as file / folder, candidate module location '/user/username/projects/myproject/node_modules/pkg2/build/index.js', target file type 'TypeScript'.
+File '/user/username/projects/myproject/node_modules/pkg2/build/index.js.ts' does not exist.
+File '/user/username/projects/myproject/node_modules/pkg2/build/index.js.tsx' does not exist.
+File '/user/username/projects/myproject/node_modules/pkg2/build/index.js.d.ts' does not exist.
+File name '/user/username/projects/myproject/node_modules/pkg2/build/index.js' has a '.js' extension - stripping it.
+File '/user/username/projects/myproject/node_modules/pkg2/build/index.ts' does not exist.
+File '/user/username/projects/myproject/node_modules/pkg2/build/index.tsx' does not exist.
+File '/user/username/projects/myproject/node_modules/pkg2/build/index.d.ts' exist - use it as a name resolution result.
+Resolving real path for '/user/username/projects/myproject/node_modules/pkg2/build/index.d.ts', result '/user/username/projects/myproject/packages/pkg2/build/index.d.ts'.
+======== Module name 'pkg2' was successfully resolved to '/user/username/projects/myproject/packages/pkg2/build/index.d.ts' with Package ID 'pkg2/build/index.d.ts@1.0.0'. ========
+File '/user/username/projects/myproject/packages/pkg2/build/package.json' does not exist.
+Found 'package.json' at '/user/username/projects/myproject/packages/pkg2/package.json'.
+'package.json' does not have a 'typesVersions' field.
+======== Resolving module './const.cjs' from '/user/username/projects/myproject/packages/pkg2/build/index.d.ts'. ========
+Using compiler options of project reference redirect '/user/username/projects/myproject/packages/pkg2/tsconfig.json'.
+Module resolution kind is not specified, using 'Node12'.
+Loading module as file / folder, candidate module location '/user/username/projects/myproject/packages/pkg2/build/const.cjs', target file type 'TypeScript'.
+File '/user/username/projects/myproject/packages/pkg2/build/const.cjs.ts' does not exist.
+File '/user/username/projects/myproject/packages/pkg2/build/const.cjs.tsx' does not exist.
+File '/user/username/projects/myproject/packages/pkg2/build/const.cjs.d.ts' does not exist.
+File name '/user/username/projects/myproject/packages/pkg2/build/const.cjs' has a '.cjs' extension - stripping it.
+File '/user/username/projects/myproject/packages/pkg2/build/const.cts' does not exist.
+File '/user/username/projects/myproject/packages/pkg2/build/const.d.cts' exist - use it as a name resolution result.
+======== Module name './const.cjs' was successfully resolved to '/user/username/projects/myproject/packages/pkg2/build/const.d.cts'. ========
+File '/a/lib/package.json' does not exist.
+File '/a/package.json' does not exist.
+File '/package.json' does not exist.
+[12:01:24 AM] Found 0 errors. Watching for file changes.
+
+
+
+Program root files: ["/user/username/projects/myproject/packages/pkg1/index.ts"]
+Program options: {"outDir":"/user/username/projects/myproject/packages/pkg1/build","module":100,"watch":true,"traceResolution":true,"configFilePath":"/user/username/projects/myproject/packages/pkg1/tsconfig.json"}
+Program structureReused: Not
+Program files::
+/a/lib/lib.es2020.full.d.ts
+/user/username/projects/myproject/packages/pkg2/build/index.d.ts
+/user/username/projects/myproject/packages/pkg1/index.ts
+
+Semantic diagnostics in builder refreshed for::
+/user/username/projects/myproject/packages/pkg1/index.ts
+
+Shape signatures in builder refreshed for::
+/user/username/projects/myproject/packages/pkg1/index.ts (computed .d.ts)
+
+WatchedFiles::
+/user/username/projects/myproject/packages/pkg2/tsconfig.json:
+  {"fileName":"/user/username/projects/myproject/packages/pkg2/tsconfig.json","pollingInterval":250}
+/user/username/projects/myproject/packages/pkg2/const.cts:
+  {"fileName":"/user/username/projects/myproject/packages/pkg2/const.cts","pollingInterval":250}
+/user/username/projects/myproject/packages/pkg2/index.ts:
+  {"fileName":"/user/username/projects/myproject/packages/pkg2/index.ts","pollingInterval":250}
+/user/username/projects/myproject/packages/pkg2/package.json:
+  {"fileName":"/user/username/projects/myproject/packages/pkg2/package.json","pollingInterval":250}
+  {"fileName":"/user/username/projects/myproject/packages/pkg2/package.json","pollingInterval":250}
+/a/lib/package.json:
+  {"fileName":"/a/lib/package.json","pollingInterval":250}
+  {"fileName":"/a/lib/package.json","pollingInterval":250}
+/a/package.json:
+  {"fileName":"/a/package.json","pollingInterval":250}
+  {"fileName":"/a/package.json","pollingInterval":250}
+/package.json:
+  {"fileName":"/package.json","pollingInterval":250}
+  {"fileName":"/package.json","pollingInterval":250}
+/user/username/projects/myproject/packages/pkg1/tsconfig.json:
+  {"fileName":"/user/username/projects/myproject/packages/pkg1/tsconfig.json","pollingInterval":250}
+/user/username/projects/myproject/packages/pkg1/index.ts:
+  {"fileName":"/user/username/projects/myproject/packages/pkg1/index.ts","pollingInterval":250}
+/user/username/projects/myproject/packages/pkg1/package.json:
+  {"fileName":"/user/username/projects/myproject/packages/pkg1/package.json","pollingInterval":250}
+/user/username/projects/myproject/packages/pkg2/build/package.json:
+  {"fileName":"/user/username/projects/myproject/packages/pkg2/build/package.json","pollingInterval":250}
+
+FsWatches::
+
+FsWatchesRecursive::
+/user/username/projects/myproject/packages/pkg2:
+  {"directoryName":"/user/username/projects/myproject/packages/pkg2","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}}
+/user/username/projects/myproject/packages/pkg1:
+  {"directoryName":"/user/username/projects/myproject/packages/pkg1","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}}
+
+exitCode:: ExitStatus.undefined
+
+//// [/user/username/projects/myproject/packages/pkg1/build/index.js] file written with same contents
+
+Change:: reports import errors after change to package file
+
+Input::
+//// [/user/username/projects/myproject/packages/pkg1/package.json]
+{"name":"pkg1","version":"1.0.0","main":"build/index.js","type":"commonjs"}
+
+
+Output::
+>> Screen clear
+[12:01:28 AM] File change detected. Starting incremental compilation...
+
+[12:01:29 AM] Project 'packages/pkg1/tsconfig.json' is out of date because oldest output 'packages/pkg1/build/index.js' is older than newest input 'packages/pkg2'
+
+[12:01:30 AM] Building project '/user/username/projects/myproject/packages/pkg1/tsconfig.json'...
+
+Found 'package.json' at '/user/username/projects/myproject/packages/pkg1/package.json'.
+'package.json' does not have a 'typesVersions' field.
+======== Resolving module 'pkg2' from '/user/username/projects/myproject/packages/pkg1/index.ts'. ========
+Module resolution kind is not specified, using 'Node12'.
+Loading module 'pkg2' from 'node_modules' folder, target file type 'TypeScript'.
+Directory '/user/username/projects/myproject/packages/pkg1/node_modules' does not exist, skipping all lookups in it.
+Directory '/user/username/projects/myproject/packages/node_modules' does not exist, skipping all lookups in it.
+Found 'package.json' at '/user/username/projects/myproject/node_modules/pkg2/package.json'.
+'package.json' does not have a 'typesVersions' field.
+File '/user/username/projects/myproject/node_modules/pkg2.ts' does not exist.
+File '/user/username/projects/myproject/node_modules/pkg2.tsx' does not exist.
+File '/user/username/projects/myproject/node_modules/pkg2.d.ts' does not exist.
+'package.json' does not have a 'typings' field.
+'package.json' does not have a 'types' field.
+'package.json' has 'main' field 'build/index.js' that references '/user/username/projects/myproject/node_modules/pkg2/build/index.js'.
+File '/user/username/projects/myproject/node_modules/pkg2/build/index.js' exist - use it as a name resolution result.
+File '/user/username/projects/myproject/node_modules/pkg2/build/index.js' has an unsupported extension, so skipping it.
+Loading module as file / folder, candidate module location '/user/username/projects/myproject/node_modules/pkg2/build/index.js', target file type 'TypeScript'.
+File '/user/username/projects/myproject/node_modules/pkg2/build/index.js.ts' does not exist.
+File '/user/username/projects/myproject/node_modules/pkg2/build/index.js.tsx' does not exist.
+File '/user/username/projects/myproject/node_modules/pkg2/build/index.js.d.ts' does not exist.
+File name '/user/username/projects/myproject/node_modules/pkg2/build/index.js' has a '.js' extension - stripping it.
+File '/user/username/projects/myproject/node_modules/pkg2/build/index.ts' does not exist.
+File '/user/username/projects/myproject/node_modules/pkg2/build/index.tsx' does not exist.
+File '/user/username/projects/myproject/node_modules/pkg2/build/index.d.ts' exist - use it as a name resolution result.
+Resolving real path for '/user/username/projects/myproject/node_modules/pkg2/build/index.d.ts', result '/user/username/projects/myproject/packages/pkg2/build/index.d.ts'.
+======== Module name 'pkg2' was successfully resolved to '/user/username/projects/myproject/packages/pkg2/build/index.d.ts' with Package ID 'pkg2/build/index.d.ts@1.0.0'. ========
+File '/user/username/projects/myproject/packages/pkg2/build/package.json' does not exist.
+Found 'package.json' at '/user/username/projects/myproject/packages/pkg2/package.json'.
+'package.json' does not have a 'typesVersions' field.
+======== Resolving module './const.cjs' from '/user/username/projects/myproject/packages/pkg2/build/index.d.ts'. ========
+Using compiler options of project reference redirect '/user/username/projects/myproject/packages/pkg2/tsconfig.json'.
+Module resolution kind is not specified, using 'Node12'.
+Loading module as file / folder, candidate module location '/user/username/projects/myproject/packages/pkg2/build/const.cjs', target file type 'TypeScript'.
+File '/user/username/projects/myproject/packages/pkg2/build/const.cjs.ts' does not exist.
+File '/user/username/projects/myproject/packages/pkg2/build/const.cjs.tsx' does not exist.
+File '/user/username/projects/myproject/packages/pkg2/build/const.cjs.d.ts' does not exist.
+File name '/user/username/projects/myproject/packages/pkg2/build/const.cjs' has a '.cjs' extension - stripping it.
+File '/user/username/projects/myproject/packages/pkg2/build/const.cts' does not exist.
+File '/user/username/projects/myproject/packages/pkg2/build/const.d.cts' exist - use it as a name resolution result.
+======== Module name './const.cjs' was successfully resolved to '/user/username/projects/myproject/packages/pkg2/build/const.d.cts'. ========
+File '/a/lib/package.json' does not exist.
+File '/a/package.json' does not exist.
+File '/package.json' does not exist.
+packages/pkg1/index.ts:1:29 - error TS1471: Module 'pkg2' cannot be imported using this construct. The specifier only resolves to an es module, which cannot be imported synchronously. Use dynamic import instead.
+
+1 import type { TheNum } from 'pkg2'
+                              ~~~~~~
+
+[12:01:31 AM] Found 1 error. Watching for file changes.
+
+
+
+Program root files: ["/user/username/projects/myproject/packages/pkg1/index.ts"]
+Program options: {"outDir":"/user/username/projects/myproject/packages/pkg1/build","module":100,"watch":true,"traceResolution":true,"configFilePath":"/user/username/projects/myproject/packages/pkg1/tsconfig.json"}
+Program structureReused: Not
+Program files::
+/a/lib/lib.es2020.full.d.ts
+/user/username/projects/myproject/packages/pkg2/build/index.d.ts
+/user/username/projects/myproject/packages/pkg1/index.ts
+
+Semantic diagnostics in builder refreshed for::
+/user/username/projects/myproject/packages/pkg1/index.ts
+
+Shape signatures in builder refreshed for::
+/user/username/projects/myproject/packages/pkg1/index.ts (computed .d.ts)
+
+WatchedFiles::
+/user/username/projects/myproject/packages/pkg2/tsconfig.json:
+  {"fileName":"/user/username/projects/myproject/packages/pkg2/tsconfig.json","pollingInterval":250}
+/user/username/projects/myproject/packages/pkg2/const.cts:
+  {"fileName":"/user/username/projects/myproject/packages/pkg2/const.cts","pollingInterval":250}
+/user/username/projects/myproject/packages/pkg2/index.ts:
+  {"fileName":"/user/username/projects/myproject/packages/pkg2/index.ts","pollingInterval":250}
+/user/username/projects/myproject/packages/pkg2/package.json:
+  {"fileName":"/user/username/projects/myproject/packages/pkg2/package.json","pollingInterval":250}
+  {"fileName":"/user/username/projects/myproject/packages/pkg2/package.json","pollingInterval":250}
+/a/lib/package.json:
+  {"fileName":"/a/lib/package.json","pollingInterval":250}
+  {"fileName":"/a/lib/package.json","pollingInterval":250}
+/a/package.json:
+  {"fileName":"/a/package.json","pollingInterval":250}
+  {"fileName":"/a/package.json","pollingInterval":250}
+/package.json:
+  {"fileName":"/package.json","pollingInterval":250}
+  {"fileName":"/package.json","pollingInterval":250}
+/user/username/projects/myproject/packages/pkg1/tsconfig.json:
+  {"fileName":"/user/username/projects/myproject/packages/pkg1/tsconfig.json","pollingInterval":250}
+/user/username/projects/myproject/packages/pkg1/index.ts:
+  {"fileName":"/user/username/projects/myproject/packages/pkg1/index.ts","pollingInterval":250}
+/user/username/projects/myproject/packages/pkg1/package.json:
+  {"fileName":"/user/username/projects/myproject/packages/pkg1/package.json","pollingInterval":250}
+/user/username/projects/myproject/packages/pkg2/build/package.json:
+  {"fileName":"/user/username/projects/myproject/packages/pkg2/build/package.json","pollingInterval":250}
+
+FsWatches::
+
+FsWatchesRecursive::
+/user/username/projects/myproject/packages/pkg2:
+  {"directoryName":"/user/username/projects/myproject/packages/pkg2","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}}
+/user/username/projects/myproject/packages/pkg1:
+  {"directoryName":"/user/username/projects/myproject/packages/pkg1","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}}
+
+exitCode:: ExitStatus.undefined
+
+
+Change:: removes those errors when a package file is changed to cjs extensions
+
+Input::
+//// [/user/username/projects/myproject/packages/pkg2/package.json]
+{"name":"pkg2","version":"1.0.0","main":"build/index.cjs","type":"module"}
+
+//// [/user/username/projects/myproject/packages/pkg2/index.cts]
+export type { TheNum } from './const.cjs';
+
+//// [/user/username/projects/myproject/packages/pkg2/index.ts] deleted
+
+Output::
+>> Screen clear
+[12:01:38 AM] File change detected. Starting incremental compilation...
+
+[12:01:39 AM] Project 'packages/pkg2/tsconfig.json' is out of date because oldest output 'packages/pkg2/build/const.cjs' is older than newest input 'packages/pkg2/index.cts'
+
+[12:01:40 AM] Building project '/user/username/projects/myproject/packages/pkg2/tsconfig.json'...
+
+======== Resolving module './const.cjs' from '/user/username/projects/myproject/packages/pkg2/index.cts'. ========
+Module resolution kind is not specified, using 'Node12'.
+Loading module as file / folder, candidate module location '/user/username/projects/myproject/packages/pkg2/const.cjs', target file type 'TypeScript'.
+File '/user/username/projects/myproject/packages/pkg2/const.cjs.ts' does not exist.
+File '/user/username/projects/myproject/packages/pkg2/const.cjs.tsx' does not exist.
+File '/user/username/projects/myproject/packages/pkg2/const.cjs.d.ts' does not exist.
+File name '/user/username/projects/myproject/packages/pkg2/const.cjs' has a '.cjs' extension - stripping it.
+File '/user/username/projects/myproject/packages/pkg2/const.cts' exist - use it as a name resolution result.
+======== Module name './const.cjs' was successfully resolved to '/user/username/projects/myproject/packages/pkg2/const.cts'. ========
+File '/a/lib/package.json' does not exist.
+File '/a/package.json' does not exist.
+File '/package.json' does not exist.
+[12:01:49 AM] Updating unchanged output timestamps of project '/user/username/projects/myproject/packages/pkg2/tsconfig.json'...
+
+
+
+Program root files: ["/user/username/projects/myproject/packages/pkg2/const.cts","/user/username/projects/myproject/packages/pkg2/index.cts"]
+Program options: {"composite":true,"outDir":"/user/username/projects/myproject/packages/pkg2/build","module":100,"watch":true,"traceResolution":true,"configFilePath":"/user/username/projects/myproject/packages/pkg2/tsconfig.json"}
+Program structureReused: Not
+Program files::
+/a/lib/lib.es2020.full.d.ts
+/user/username/projects/myproject/packages/pkg2/const.cts
+/user/username/projects/myproject/packages/pkg2/index.cts
+
+Semantic diagnostics in builder refreshed for::
+/user/username/projects/myproject/packages/pkg2/index.cts
+
+Shape signatures in builder refreshed for::
+/user/username/projects/myproject/packages/pkg2/index.cts (computed .d.ts)
+
+WatchedFiles::
+/user/username/projects/myproject/packages/pkg2/tsconfig.json:
+  {"fileName":"/user/username/projects/myproject/packages/pkg2/tsconfig.json","pollingInterval":250}
+/user/username/projects/myproject/packages/pkg2/const.cts:
+  {"fileName":"/user/username/projects/myproject/packages/pkg2/const.cts","pollingInterval":250}
+/user/username/projects/myproject/packages/pkg2/package.json:
+  {"fileName":"/user/username/projects/myproject/packages/pkg2/package.json","pollingInterval":250}
+  {"fileName":"/user/username/projects/myproject/packages/pkg2/package.json","pollingInterval":250}
+/a/lib/package.json:
+  {"fileName":"/a/lib/package.json","pollingInterval":250}
+  {"fileName":"/a/lib/package.json","pollingInterval":250}
+/a/package.json:
+  {"fileName":"/a/package.json","pollingInterval":250}
+  {"fileName":"/a/package.json","pollingInterval":250}
+/package.json:
+  {"fileName":"/package.json","pollingInterval":250}
+  {"fileName":"/package.json","pollingInterval":250}
+/user/username/projects/myproject/packages/pkg1/tsconfig.json:
+  {"fileName":"/user/username/projects/myproject/packages/pkg1/tsconfig.json","pollingInterval":250}
+/user/username/projects/myproject/packages/pkg1/index.ts:
+  {"fileName":"/user/username/projects/myproject/packages/pkg1/index.ts","pollingInterval":250}
+/user/username/projects/myproject/packages/pkg1/package.json:
+  {"fileName":"/user/username/projects/myproject/packages/pkg1/package.json","pollingInterval":250}
+/user/username/projects/myproject/packages/pkg2/build/package.json:
+  {"fileName":"/user/username/projects/myproject/packages/pkg2/build/package.json","pollingInterval":250}
+/user/username/projects/myproject/packages/pkg2/index.cts:
+  {"fileName":"/user/username/projects/myproject/packages/pkg2/index.cts","pollingInterval":250}
+
+FsWatches::
+
+FsWatchesRecursive::
+/user/username/projects/myproject/packages/pkg2:
+  {"directoryName":"/user/username/projects/myproject/packages/pkg2","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}}
+/user/username/projects/myproject/packages/pkg1:
+  {"directoryName":"/user/username/projects/myproject/packages/pkg1","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}}
+
+exitCode:: ExitStatus.undefined
+
+//// [/user/username/projects/myproject/packages/pkg2/build/const.cjs] file changed its modified time
+//// [/user/username/projects/myproject/packages/pkg2/build/const.d.cts] file changed its modified time
+//// [/user/username/projects/myproject/packages/pkg2/build/tsconfig.tsbuildinfo]
+{"program":{"fileNames":["../../../../../../../a/lib/lib.es2020.full.d.ts","../const.cts","../index.cts"],"fileInfos":[{"version":"-7698705165-/// <reference no-default-lib=\"true\"/>\ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array<T> { length: number; [n: number]: T; }","affectsGlobalScope":true,"impliedFormat":1},"-11202312776-export type TheNum = 42;",{"version":"-9668872159-export type { TheNum } from './const.cjs';","signature":"-9835135925-export type { TheNum } from './const.cjs';\n","impliedFormat":1}],"options":{"composite":true,"module":100,"outDir":"./"},"fileIdsList":[[2]],"referencedMap":[[3,1]],"exportedModulesMap":[[3,1]],"semanticDiagnosticsPerFile":[1,2,3]},"version":"FakeTSVersion"}
+
+//// [/user/username/projects/myproject/packages/pkg2/build/tsconfig.tsbuildinfo.readable.baseline.txt]
+{
+  "program": {
+    "fileNames": [
+      "../../../../../../../a/lib/lib.es2020.full.d.ts",
+      "../const.cts",
+      "../index.cts"
+    ],
+    "fileNamesList": [
+      [
+        "../const.cts"
+      ]
+    ],
+    "fileInfos": {
+      "../../../../../../../a/lib/lib.es2020.full.d.ts": {
+        "version": "-7698705165-/// <reference no-default-lib=\"true\"/>\ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array<T> { length: number; [n: number]: T; }",
+        "signature": "-7698705165-/// <reference no-default-lib=\"true\"/>\ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array<T> { length: number; [n: number]: T; }",
+        "affectsGlobalScope": true,
+        "impliedFormat": 1
+      },
+      "../const.cts": {
+        "version": "-11202312776-export type TheNum = 42;",
+        "signature": "-11202312776-export type TheNum = 42;"
+      },
+      "../index.cts": {
+        "version": "-9668872159-export type { TheNum } from './const.cjs';",
+        "signature": "-9835135925-export type { TheNum } from './const.cjs';\n",
+        "impliedFormat": 1
+      }
+    },
+    "options": {
+      "composite": true,
+      "module": 100,
+      "outDir": "./"
+    },
+    "referencedMap": {
+      "../index.cts": [
+        "../const.cts"
+      ]
+    },
+    "exportedModulesMap": {
+      "../index.cts": [
+        "../const.cts"
+      ]
+    },
+    "semanticDiagnosticsPerFile": [
+      "../../../../../../../a/lib/lib.es2020.full.d.ts",
+      "../const.cts",
+      "../index.cts"
+    ]
+  },
+  "version": "FakeTSVersion",
+  "size": 928
+}
+
+//// [/user/username/projects/myproject/packages/pkg2/build/index.cjs]
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+
+
+//// [/user/username/projects/myproject/packages/pkg2/build/index.d.cts]
+export type { TheNum } from './const.cjs';
+
+
diff --git a/tests/cases/conformance/node/allowJs/nodeModulesAllowJs1.ts b/tests/cases/conformance/node/allowJs/nodeModulesAllowJs1.ts
index 9b27ee95c1789..174300a96b045 100644
--- a/tests/cases/conformance/node/allowJs/nodeModulesAllowJs1.ts
+++ b/tests/cases/conformance/node/allowJs/nodeModulesAllowJs1.ts
@@ -7,15 +7,120 @@
 // cjs format file
 const x = 1;
 export {x};
+// @filename: subfolder/index.cjs
+// cjs format file
+const x = 1;
+export {x};
+// @filename: subfolder/index.mjs
+// esm format file
+const x = 1;
+export {x};
 // @filename: subfolder2/index.js
 // cjs format file
 const x = 1;
 export {x};
+// @filename: subfolder2/index.cjs
+// cjs format file
+const x = 1;
+export {x};
+// @filename: subfolder2/index.mjs
+// esm format file
+const x = 1;
+export {x};
 // @filename: subfolder2/another/index.js
 // esm format file
 const x = 1;
 export {x};
+// @filename: subfolder2/another/index.cjs
+// cjs format file
+const x = 1;
+export {x};
+// @filename: subfolder2/another/index.mjs
+// esm format file
+const x = 1;
+export {x};
 // @filename: index.js
+import * as m1 from "./index.js";
+import * as m2 from "./index.mjs";
+import * as m3 from "./index.cjs";
+import * as m4 from "./subfolder/index.js";
+import * as m5 from "./subfolder/index.mjs";
+import * as m6 from "./subfolder/index.cjs";
+import * as m7 from "./subfolder2/index.js";
+import * as m8 from "./subfolder2/index.mjs";
+import * as m9 from "./subfolder2/index.cjs";
+import * as m10 from "./subfolder2/another/index.js";
+import * as m11 from "./subfolder2/another/index.mjs";
+import * as m12 from "./subfolder2/another/index.cjs";
+void m1;
+void m2;
+void m3;
+void m4;
+void m5;
+void m6;
+void m7;
+void m8;
+void m9;
+void m10;
+void m11;
+void m12;
+// esm format file
+const x = 1;
+export {x};
+// @filename: index.cjs
+// ESM format imports below should error
+import * as m1 from "./index.js";
+import * as m2 from "./index.mjs";
+import * as m3 from "./index.cjs";
+import * as m4 from "./subfolder/index.js";
+import * as m5 from "./subfolder/index.mjs";
+import * as m6 from "./subfolder/index.cjs";
+import * as m7 from "./subfolder2/index.js";
+import * as m8 from "./subfolder2/index.mjs";
+import * as m9 from "./subfolder2/index.cjs";
+import * as m10 from "./subfolder2/another/index.js";
+import * as m11 from "./subfolder2/another/index.mjs";
+import * as m12 from "./subfolder2/another/index.cjs";
+void m1;
+void m2;
+void m3;
+void m4;
+void m5;
+void m6;
+void m7;
+void m8;
+void m9;
+void m10;
+void m11;
+void m12;
+// cjs format file
+const x = 1;
+export {x};
+// @filename: index.mjs
+import * as m1 from "./index.js";
+import * as m2 from "./index.mjs";
+import * as m3 from "./index.cjs";
+import * as m4 from "./subfolder/index.js";
+import * as m5 from "./subfolder/index.mjs";
+import * as m6 from "./subfolder/index.cjs";
+import * as m7 from "./subfolder2/index.js";
+import * as m8 from "./subfolder2/index.mjs";
+import * as m9 from "./subfolder2/index.cjs";
+import * as m10 from "./subfolder2/another/index.js";
+import * as m11 from "./subfolder2/another/index.mjs";
+import * as m12 from "./subfolder2/another/index.cjs";
+void m1;
+void m2;
+void m3;
+void m4;
+void m5;
+void m6;
+void m7;
+void m8;
+void m9;
+void m10;
+void m11;
+void m12;
 // esm format file
 const x = 1;
 export {x};
diff --git a/tests/cases/conformance/node/nodeModules1.ts b/tests/cases/conformance/node/nodeModules1.ts
index 349d103b0efcf..b0ba13a1e346e 100644
--- a/tests/cases/conformance/node/nodeModules1.ts
+++ b/tests/cases/conformance/node/nodeModules1.ts
@@ -4,15 +4,120 @@
 // cjs format file
 const x = 1;
 export {x};
+// @filename: subfolder/index.cts
+// cjs format file
+const x = 1;
+export {x};
+// @filename: subfolder/index.mts
+// esm format file
+const x = 1;
+export {x};
 // @filename: subfolder2/index.ts
 // cjs format file
 const x = 1;
 export {x};
+// @filename: subfolder2/index.cts
+// cjs format file
+const x = 1;
+export {x};
+// @filename: subfolder2/index.mts
+// esm format file
+const x = 1;
+export {x};
 // @filename: subfolder2/another/index.ts
 // esm format file
 const x = 1;
 export {x};
+// @filename: subfolder2/another/index.mts
+// esm format file
+const x = 1;
+export {x};
+// @filename: subfolder2/another/index.cts
+// cjs format file
+const x = 1;
+export {x};
+// @filename: index.mts
+import * as m1 from "./index.js";
+import * as m2 from "./index.mjs";
+import * as m3 from "./index.cjs";
+import * as m4 from "./subfolder/index.js";
+import * as m5 from "./subfolder/index.mjs";
+import * as m6 from "./subfolder/index.cjs";
+import * as m7 from "./subfolder2/index.js";
+import * as m8 from "./subfolder2/index.mjs";
+import * as m9 from "./subfolder2/index.cjs";
+import * as m10 from "./subfolder2/another/index.js";
+import * as m11 from "./subfolder2/another/index.mjs";
+import * as m12 from "./subfolder2/another/index.cjs";
+void m1;
+void m2;
+void m3;
+void m4;
+void m5;
+void m6;
+void m7;
+void m8;
+void m9;
+void m10;
+void m11;
+void m12;
+// esm format file
+const x = 1;
+export {x};
+// @filename: index.cts
+// ESM-format imports below should issue errors
+import * as m1 from "./index.js";
+import * as m2 from "./index.mjs";
+import * as m3 from "./index.cjs";
+import * as m4 from "./subfolder/index.js";
+import * as m5 from "./subfolder/index.mjs";
+import * as m6 from "./subfolder/index.cjs";
+import * as m7 from "./subfolder2/index.js";
+import * as m8 from "./subfolder2/index.mjs";
+import * as m9 from "./subfolder2/index.cjs";
+import * as m10 from "./subfolder2/another/index.js";
+import * as m11 from "./subfolder2/another/index.mjs";
+import * as m12 from "./subfolder2/another/index.cjs";
+void m1;
+void m2;
+void m3;
+void m4;
+void m5;
+void m6;
+void m7;
+void m8;
+void m9;
+void m10;
+void m11;
+void m12;
+// cjs format file
+const x = 1;
+export {x};
 // @filename: index.ts
+import * as m1 from "./index.js";
+import * as m2 from "./index.mjs";
+import * as m3 from "./index.cjs";
+import * as m4 from "./subfolder/index.js";
+import * as m5 from "./subfolder/index.mjs";
+import * as m6 from "./subfolder/index.cjs";
+import * as m7 from "./subfolder2/index.js";
+import * as m8 from "./subfolder2/index.mjs";
+import * as m9 from "./subfolder2/index.cjs";
+import * as m10 from "./subfolder2/another/index.js";
+import * as m11 from "./subfolder2/another/index.mjs";
+import * as m12 from "./subfolder2/another/index.cjs";
+void m1;
+void m2;
+void m3;
+void m4;
+void m5;
+void m6;
+void m7;
+void m8;
+void m9;
+void m10;
+void m11;
+void m12;
 // esm format file
 const x = 1;
 export {x};
diff --git a/tests/cases/conformance/node/nodeModulesForbidenSyntax.ts b/tests/cases/conformance/node/nodeModulesForbidenSyntax.ts
new file mode 100644
index 0000000000000..d441627d7d0c4
--- /dev/null
+++ b/tests/cases/conformance/node/nodeModulesForbidenSyntax.ts
@@ -0,0 +1,67 @@
+// @module: node12,nodenext
+// @declaration: true
+// @filename: subfolder/index.ts
+// cjs format file
+const x = <T>() => <T><any>(void 0);
+export {x};
+// @filename: subfolder/index.cts
+// cjs format file
+const x = <T>() => <T><any>(void 0);
+export {x};
+// @filename: subfolder/index.mts
+// esm format file
+const x = <T>() => <T><any>(void 0);
+export {x};
+// @filename: subfolder2/index.ts
+// cjs format file
+const x = <T>() => <T><any>(void 0);
+export {x};
+// @filename: subfolder2/index.cts
+// cjs format file
+const x = <T>() => <T><any>(void 0);
+export {x};
+// @filename: subfolder2/index.mts
+// esm format file
+const x = <T>() => <T><any>(void 0);
+export {x};
+// @filename: subfolder2/another/index.ts
+// esm format file
+const x = <T>() => <T><any>(void 0);
+export {x};
+// @filename: subfolder2/another/index.mts
+// esm format file
+const x = <T>() => <T><any>(void 0);
+export {x};
+// @filename: subfolder2/another/index.cts
+// cjs format file
+const x = <T>() => <T><any>(void 0);
+export {x};
+// @filename: index.mts
+// esm format file
+const x = <T>() => <T><any>(void 0);
+export {x};
+// @filename: index.cts
+// cjs format file
+const x = <T>() => <T><any>(void 0);
+export {x};
+// @filename: index.ts
+// esm format file
+const x = <T>() => <T><any>(void 0);
+export {x};
+// @filename: package.json
+{
+    "name": "package",
+    "private": true,
+    "type": "module"
+}
+// @filename: subfolder/package.json
+{
+    "type": "commonjs"
+}
+// @filename: subfolder2/package.json
+{
+}
+// @filename: subfolder2/another/package.json
+{
+    "type": "module"
+}
\ No newline at end of file