Skip to content

Commit 8f9e303

Browse files
committed
test(rsc-mf): assert dedupe behavior in remote expose config
1 parent a689f5b commit 8f9e303

2 files changed

Lines changed: 17 additions & 1 deletion

File tree

tests/integration/rsc-mf/remote/module-federation.config.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,10 @@ const remoteExposeImports: Record<string, ExposeDefinitionInput> = {
3232
'./defaultAction': './src/components/defaultAction.ts',
3333
'./actionBundle': './src/components/actionBundle.ts',
3434
'./infoBundle': {
35-
import: './src/components/infoBundle.ts',
35+
import: [
36+
'./src/components/infoBundle.ts',
37+
'./src/components/infoBundle.ts',
38+
],
3639
},
3740
};
3841

tests/integration/rsc-mf/tests/moduleFederationConfig.test.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,19 @@ describe('rsc-mf module federation config contracts', () => {
139139
);
140140
});
141141

142+
it('deduplicates repeated imports in object expose definitions', () => {
143+
const remoteConfig = loadRemoteConfig();
144+
const infoBundleExpose = remoteConfig.exposes?.['./infoBundle'] as
145+
| {
146+
import?: string[];
147+
}
148+
| undefined;
149+
expect(infoBundleExpose?.import).toEqual([
150+
CALLBACK_BOOTSTRAP_IMPORT,
151+
'./src/components/infoBundle.ts',
152+
]);
153+
});
154+
142155
it('uses remote port env var in host manifest remote URL', () => {
143156
const hostConfig = loadHostConfig({
144157
nodeEnv: 'test',

0 commit comments

Comments
 (0)