Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ export function isSubpathDefinedInExportsLike(
// Attempt to match after expanding any subpath pattern keys
for (const key of exportsLikeMap.keys()) {
if (
key.split('*').length === 2 &&
matchSubpathPattern(key, subpath) != null
) {
return true;
Expand Down
7 changes: 6 additions & 1 deletion packages/metro-resolver/src/utils/matchSubpathPattern.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,12 @@ export function matchSubpathPattern(
subpathPattern: string,
subpath: string,
): string | null {
const [patternBase, patternTrailer] = subpathPattern.split('*');
const wildcardIndex = subpathPattern.indexOf('*');
if (wildcardIndex === -1 || subpathPattern.indexOf('*', wildcardIndex + 1) !== -1) {
return null;
}
const patternBase = subpathPattern.substring(0, wildcardIndex);
const patternTrailer = subpathPattern.substring(wildcardIndex + 1);

if (
subpath.startsWith(patternBase) &&
Expand Down
Loading