Skip to content

Share flalback #3893

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 5 commits into
base: share-filter
Choose a base branch
from
Open
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
45 changes: 30 additions & 15 deletions packages/enhanced/src/lib/sharing/ConsumeSharedPlugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -481,9 +481,13 @@ class ConsumeSharedPlugin {
}
const { context, request, contextInfo } = resolveData;

const match = unresolvedConsumes.get(
createLookupKeyForSharing(request, contextInfo.issuerLayer),
);
const match =
unresolvedConsumes.get(
createLookupKeyForSharing(request, contextInfo.issuerLayer),
) ||
unresolvedConsumes.get(
createLookupKeyForSharing(request, undefined),
);

// First check direct match with original request
if (match !== undefined) {
Expand Down Expand Up @@ -511,12 +515,19 @@ class ConsumeSharedPlugin {

// Try to match with module path after node_modules
if (modulePathAfterNodeModules) {
const moduleMatch = unresolvedConsumes.get(
createLookupKeyForSharing(
modulePathAfterNodeModules,
contextInfo.issuerLayer,
),
);
const moduleMatch =
unresolvedConsumes.get(
createLookupKeyForSharing(
modulePathAfterNodeModules,
contextInfo.issuerLayer,
),
) ||
unresolvedConsumes.get(
createLookupKeyForSharing(
modulePathAfterNodeModules,
undefined,
),
);

if (
moduleMatch !== undefined &&
Expand All @@ -532,12 +543,16 @@ class ConsumeSharedPlugin {
}

// Try to match with the full reconstructed path
const reconstructedMatch = unresolvedConsumes.get(
createLookupKeyForSharing(
reconstructed,
contextInfo.issuerLayer,
),
);
const reconstructedMatch =
unresolvedConsumes.get(
createLookupKeyForSharing(
reconstructed,
contextInfo.issuerLayer,
),
) ||
unresolvedConsumes.get(
createLookupKeyForSharing(reconstructed, undefined),
);

if (reconstructedMatch !== undefined) {
return boundCreateConsumeSharedModule(
Expand Down
Loading