Skip to content

Commit 2700ba1

Browse files
chore(webpack-bundler-runtime): add more details tip for loadShareSync (#2466)
Co-authored-by: Zack Jackson <[email protected]>
1 parent 7c3a583 commit 2700ba1

File tree

2 files changed

+16
-3
lines changed

2 files changed

+16
-3
lines changed

.changeset/brave-meals-hug.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@module-federation/webpack-bundler-runtime': patch
3+
---
4+
5+
chore(webpack-bundler-runtime): add more details tip for loadShareSync

packages/webpack-bundler-runtime/src/installInitialConsumes.ts

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,17 @@ function handleInitialConsumes(options: HandleInitialConsumesOptions) {
1111
}
1212
const { shareKey, shareInfo } = moduleToHandlerMapping[moduleId];
1313

14-
return federationInstance.loadShareSync(shareKey, {
15-
customShareInfo: shareInfo,
16-
});
14+
try {
15+
return federationInstance.loadShareSync(shareKey, {
16+
customShareInfo: shareInfo,
17+
});
18+
} catch (err) {
19+
console.error(
20+
'loadShareSync failed! The function should not be called unless you set "eager:true". If you do not set it, and encounter this issue, you can check whether an async boundary is implemented.',
21+
);
22+
console.error('The original error message is as follows: ');
23+
throw err;
24+
}
1725
}
1826

1927
export function installInitialConsumes(options: InstallInitialConsumesOptions) {

0 commit comments

Comments
 (0)