Skip to content

Commit aec701a

Browse files
committed
refactor: keep CorePlugin noop impl as fallback
1 parent 9b9a08b commit aec701a

2 files changed

Lines changed: 18 additions & 0 deletions

File tree

packages/repack/src/modules/FederationRuntimePlugins/CorePlugin.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,14 @@ const RepackCorePlugin: () => FederationRuntimePlugin = () => ({
2727
console.error(`Failed to load remote entry: ${entryGlobalName}`);
2828
}
2929
},
30+
generatePreloadAssets: async () => {
31+
// noop for compatibility
32+
return Promise.resolve({
33+
cssAssets: [],
34+
jsAssetsWithoutEntry: [],
35+
entryAssets: [],
36+
});
37+
},
3038
});
3139

3240
export default RepackCorePlugin;

packages/repack/src/modules/FederationRuntimePlugins/__tests__/CorePlugin.test.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,4 +129,14 @@ describe('RepackCorePlugin', () => {
129129
`Failed to load remote entry: ${mockRemoteInfo.entryGlobalName}`
130130
);
131131
});
132+
133+
it('should provide a noop generatePreloadAssets implementation', async () => {
134+
const plugin = RepackCorePlugin();
135+
136+
const result = await plugin.generatePreloadAssets!({} as any);
137+
138+
expect(result).toHaveProperty('cssAssets');
139+
expect(result).toHaveProperty('jsAssetsWithoutEntry');
140+
expect(result).toHaveProperty('entryAssets');
141+
});
132142
});

0 commit comments

Comments
 (0)