Skip to content

Commit 85990e2

Browse files
authored
fix(dts-plugin): hold the broker server if the remote not start locally (#3202)
1 parent 1a80706 commit 85990e2

File tree

2 files changed

+18
-2
lines changed

2 files changed

+18
-2
lines changed

.changeset/fair-plums-live.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@module-federation/dts-plugin': patch
3+
---
4+
5+
fix(dts-plugin): hold the broker server if the remote not start locally

packages/dts-plugin/src/server/DevServer.ts

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -314,8 +314,19 @@ export class ModuleFederationDevServer {
314314
'warn',
315315
);
316316

317-
this._subscriberWebsocketMap[identifier] &&
318-
this._subscriberWebsocketMap[identifier].close();
317+
this._subscriberWebsocketMap[identifier]?.close();
318+
delete this._subscriberWebsocketMap[identifier];
319+
});
320+
321+
this._subscriberWebsocketMap[identifier].on('error', (event) => {
322+
if ('code' in event && event.code === 'ETIMEDOUT') {
323+
fileLog(
324+
`Can not connect ${JSON.stringify(remote)}, please make sure this remote is started locally.`,
325+
MF_SERVER_IDENTIFIER,
326+
'warn',
327+
);
328+
}
329+
this._subscriberWebsocketMap[identifier]?.close();
319330
delete this._subscriberWebsocketMap[identifier];
320331
});
321332
}

0 commit comments

Comments
 (0)