Fix declaration emit in --moduleResolution bundler using wrong exports conditions (#56265)

This commit is contained in:
Andrew Branch
2023-10-30 17:39:57 -05:00
committed by GitHub
parent 60ce788302
commit 0ee2db33ca
5 changed files with 87 additions and 18 deletions

View File

@@ -992,7 +992,7 @@ function tryGetModuleNameAsNodeModule({ path, isRedirect }: ModulePath, { getCan
// use the actual directory name, so don't look at `packageJsonContent.name` here.
const nodeModulesDirectoryName = packageRootPath.substring(parts.topLevelPackageNameIndex + 1);
const packageName = getPackageNameFromTypesPackageName(nodeModulesDirectoryName);
const conditions = getConditions(options, importMode === ModuleKind.ESNext);
const conditions = getConditions(options, importMode);
const fromExports = packageJsonContent.exports
? tryGetModuleNameFromExports(options, path, packageRootPath, packageName, packageJsonContent.exports, conditions)
: undefined;