Skip to content

Commit 017fac3

Browse files
Merge branch 'pr8-unified-api' into pr9-implementation
2 parents eac5e94 + 1908940 commit 017fac3

File tree

4 files changed

+30
-13
lines changed

4 files changed

+30
-13
lines changed

.changeset/shiny-pigs-tap.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@module-federation/bridge-react': patch
3+
---
4+
5+
fix(bridge-react): call preloadAssets after getting assets

.changeset/strange-years-cross.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@module-federation/manifest': patch
3+
---
4+
5+
fix(manifest): collect cached modules since rspack support cache

packages/bridge/bridge-react/src/lazy/data-fetch/prefetch.ts

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -44,19 +44,25 @@ export async function prefetch(options: PrefetchOptions) {
4444
if (preloadComponentResource) {
4545
const remoteInfo = helpers.utils.getRemoteInfo(remote);
4646

47-
instance.remoteHandler.hooks.lifecycle.generatePreloadAssets.emit({
48-
origin: instance,
49-
preloadOptions: {
50-
remote,
51-
preloadConfig: {
52-
nameOrAlias: remote.name,
53-
exposes: [expose],
47+
Promise.resolve(
48+
instance.remoteHandler.hooks.lifecycle.generatePreloadAssets.emit({
49+
origin: instance,
50+
preloadOptions: {
51+
remote,
52+
preloadConfig: {
53+
nameOrAlias: remote.name,
54+
exposes: [expose],
55+
},
5456
},
55-
},
56-
remote,
57-
remoteInfo,
58-
globalSnapshot,
59-
remoteSnapshot,
57+
remote,
58+
remoteInfo,
59+
globalSnapshot,
60+
remoteSnapshot,
61+
}),
62+
).then((assets) => {
63+
if (assets) {
64+
helpers.utils.preloadAssets(remoteInfo, instance, assets);
65+
}
6066
});
6167
}
6268

packages/manifest/src/StatsManager.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -337,8 +337,9 @@ class StatsManager {
337337
};
338338
if (this._bundler === 'webpack') {
339339
statsOptions['cached'] = true;
340-
statsOptions['cachedModules'] = true;
341340
}
341+
statsOptions['cachedModules'] = true;
342+
342343
const webpackStats = liveStats.toJson(statsOptions);
343344

344345
const filteredModules = this._getFilteredModules(webpackStats);

0 commit comments

Comments
 (0)