Skip to content

Commit

Permalink
keep this context for callbacks
Browse files Browse the repository at this point in the history
  • Loading branch information
patricklx authored Oct 5, 2023
1 parent 841a039 commit 93387d2
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions packages/commonjs/src/resolve-require-sources.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ export function getRequireResolver(extensions, detectCyclesAndConditional, curre
setInitialParentType(parentId, parentMeta.initialCommonJSType);
await Promise.all(
parentRequires.map(({ resolved, isConditional }) =>
analyzeRequiredModule(parentId, resolved, isConditional, this.load)
analyzeRequiredModule(parentId, resolved, isConditional, this.load.bind(this))
)
);
if (getTypeForFullyAnalyzedModule(parentId) !== parentMeta.isCommonJS) {
Expand Down Expand Up @@ -143,11 +143,11 @@ export function getRequireResolver(extensions, detectCyclesAndConditional, curre
(
await this.load({ id: resolved.id })
).meta.commonjs.resolved,
this.load
this.load.bind(this)
)) !== IS_WRAPPED_COMMONJS
);
}
return (await getTypeForImportedModule(resolved, this.load)) === IS_WRAPPED_COMMONJS;
return (await getTypeForImportedModule(resolved, this.load.bind(this))) === IS_WRAPPED_COMMONJS;
})
)
).some((shouldTransform) => shouldTransform);
Expand Down Expand Up @@ -182,7 +182,7 @@ export function getRequireResolver(extensions, detectCyclesAndConditional, curre
return { id: wrapId(childId, EXTERNAL_SUFFIX), allowProxy: false };
}
parentMeta.requires.push({ resolved, isConditional });
await analyzeRequiredModule(parentId, resolved, isConditional, rollupContext.load);
await analyzeRequiredModule(parentId, resolved, isConditional, rollupContext.load.bind(this);
return { id: childId, allowProxy: true };
})
);
Expand Down

0 comments on commit 93387d2

Please sign in to comment.