Skip to content

Commit a4294f6

Browse files
author
Sean Callahan
committed
Fix formatting (trailing whitespace)
1 parent e3ae3f7 commit a4294f6

File tree

1 file changed

+22
-22
lines changed

1 file changed

+22
-22
lines changed

src/compiler/moduleNameResolver.ts

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -2114,28 +2114,28 @@ function loadFileNameFromPackageJsonField(extensions: Extensions, candidate: str
21142114
return result !== undefined ? { path: candidate, ext, resolvedUsingTsExtension: packageJsonValue ? !endsWith(packageJsonValue, ext) : undefined } : undefined;
21152115
}
21162116

2117-
if (state.isConfigLookup && extensions === Extensions.Json && fileExtensionIs(candidate, Extension.Json)) {
2118-
const result = tryFile(candidate, onlyRecordFailures, state);
2119-
return result !== undefined ? { path: candidate, ext: Extension.Json, resolvedUsingTsExtension: undefined } : undefined;
2120-
}
2121-
2122-
// First, try replacing an existing JS extension with a TS extension (e.g., ./foo.js -> ./foo.ts)
2123-
const resolvedByReplacingExtension = loadModuleFromFileNoImplicitExtensions(extensions, candidate, onlyRecordFailures, state);
2124-
if (resolvedByReplacingExtension) {
2125-
return resolvedByReplacingExtension;
2126-
}
2127-
2128-
// For extensionless paths in bundler mode (non-ESM), try adding extensions (e.g., ./foo -> ./foo.ts)
2129-
// This mirrors the behavior of loadModuleFromFile for regular imports.
2130-
if (!(state.features & NodeResolutionFeatures.EsmMode)) {
2131-
const filename = getBaseFileName(candidate);
2132-
if (!filename.includes(".")) {
2133-
return tryAddingExtensions(candidate, extensions, "", onlyRecordFailures, state);
2134-
}
2135-
}
2136-
2137-
return undefined;
2138-
}
2117+
if (state.isConfigLookup && extensions === Extensions.Json && fileExtensionIs(candidate, Extension.Json)) {
2118+
const result = tryFile(candidate, onlyRecordFailures, state);
2119+
return result !== undefined ? { path: candidate, ext: Extension.Json, resolvedUsingTsExtension: undefined } : undefined;
2120+
}
2121+
2122+
// First, try replacing an existing JS extension with a TS extension (e.g., ./foo.js -> ./foo.ts)
2123+
const resolvedByReplacingExtension = loadModuleFromFileNoImplicitExtensions(extensions, candidate, onlyRecordFailures, state);
2124+
if (resolvedByReplacingExtension) {
2125+
return resolvedByReplacingExtension;
2126+
}
2127+
2128+
// For extensionless paths in bundler mode (non-ESM), try adding extensions (e.g., ./foo -> ./foo.ts)
2129+
// This mirrors the behavior of loadModuleFromFile for regular imports.
2130+
if (!(state.features & NodeResolutionFeatures.EsmMode)) {
2131+
const filename = getBaseFileName(candidate);
2132+
if (!filename.includes(".")) {
2133+
return tryAddingExtensions(candidate, extensions, "", onlyRecordFailures, state);
2134+
}
2135+
}
2136+
2137+
return undefined;
2138+
}
21392139

21402140
/** Try to return an existing file that adds one of the `extensions` to `candidate`. */
21412141
function tryAddingExtensions(candidate: string, extensions: Extensions, originalExtension: string, onlyRecordFailures: boolean, state: ModuleResolutionState): PathAndExtension | undefined {

0 commit comments

Comments
 (0)