Skip to content

Commit

Permalink
Fix conditional wildcard module specifier generation bug
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewbranch committed Jun 29, 2023
1 parent 77267b5 commit 04c06ee
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/compiler/moduleSpecifiers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -860,7 +860,7 @@ function tryGetModuleNameFromExports(options: CompilerOptions, targetFilePath: s
for (const key of getOwnKeys(exports as MapLike<unknown>)) {
if (key === "default" || conditions.indexOf(key) >= 0 || isApplicableVersionedTypesKey(conditions, key)) {
const subTarget = (exports as MapLike<unknown>)[key];
const result = tryGetModuleNameFromExports(options, targetFilePath, packageDirectory, packageName, subTarget, conditions);
const result = tryGetModuleNameFromExports(options, targetFilePath, packageDirectory, packageName, subTarget, conditions, mode);
if (result) {
return result;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@
//// "exports": {
//// "./*": "./a/*.js",
//// "./b/*.js": "./b/*.js",
//// "./c/*": "./c/*"
//// "./c/*": "./c/*",
//// "./d/*": {
//// "import": "./d/*.mjs"
//// }
//// }
//// }

Expand All @@ -26,6 +29,9 @@
// @Filename: /node_modules/pkg/c/subfolder/c2.d.mts
//// export const c2: number;

// @Filename: /node_modules/pkg/d/d1.d.mts
//// export const d1: number;

// @Filename: /package.json
//// {
//// "type": "module",
Expand Down Expand Up @@ -74,6 +80,13 @@ verify.completions({
sourceDisplay: "pkg/c/subfolder/c2.mjs",
hasAction: true,
sortText: completion.SortText.AutoImportSuggestions
},
{
name: "d1",
source: "pkg/d/d1",
sourceDisplay: "pkg/d/d1",
hasAction: true,
sortText: completion.SortText.AutoImportSuggestions
}
],
preferences: {
Expand Down

0 comments on commit 04c06ee

Please sign in to comment.