Skip to content

Commit

Permalink
fix(mf): should compile @module-federation/sdk (#3270)
Browse files Browse the repository at this point in the history
  • Loading branch information
chenjiahan authored Aug 23, 2024
1 parent 0e8ad94 commit e7b8758
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 35 deletions.
72 changes: 37 additions & 35 deletions e2e/cases/module-federation/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,45 +93,47 @@ rspackOnlyTest(
},
);

// TODO: fix this test
test.fail('should transform module federation runtime with SWC', async () => {
writeButtonCode();
rspackOnlyTest(
'should transform module federation runtime with SWC',
async () => {
writeButtonCode();

const remotePort = await getRandomPort();
const remotePort = await getRandomPort();

process.env.REMOTE_PORT = remotePort.toString();
process.env.REMOTE_PORT = remotePort.toString();

await expect(
build({
cwd: remote,
rsbuildConfig: {
output: {
overrideBrowserslist: ['Chrome >= 51'],
},
performance: {
chunkSplit: {
strategy: 'all-in-one',
await expect(
build({
cwd: remote,
rsbuildConfig: {
output: {
overrideBrowserslist: ['Chrome >= 51'],
},
performance: {
chunkSplit: {
strategy: 'all-in-one',
},
},
plugins: [pluginCheckSyntax()],
},
plugins: [pluginCheckSyntax()],
},
}),
).resolves.toBeTruthy();

await expect(
build({
cwd: host,
rsbuildConfig: {
output: {
overrideBrowserslist: ['Chrome >= 51'],
},
performance: {
chunkSplit: {
strategy: 'all-in-one',
}),
).resolves.toBeTruthy();

await expect(
build({
cwd: host,
rsbuildConfig: {
output: {
overrideBrowserslist: ['Chrome >= 51'],
},
performance: {
chunkSplit: {
strategy: 'all-in-one',
},
},
plugins: [pluginCheckSyntax()],
},
plugins: [pluginCheckSyntax()],
},
}),
).resolves.toBeTruthy();
});
}),
).resolves.toBeTruthy();
},
);
1 change: 1 addition & 0 deletions packages/core/src/plugins/moduleFederation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ export function pluginModuleFederation(): RsbuildPlugin {
// adding to include and let SWC transform it
config.source.include = [
...(config.source.include || []),
/@module-federation[\\/]sdk/,
/@module-federation[\\/]runtime/,
];
});
Expand Down

0 comments on commit e7b8758

Please sign in to comment.