Skip to content

Commit

Permalink
fix(dts-plugin): hold the broker server if the remote not start local…
Browse files Browse the repository at this point in the history
…ly (#3202)
  • Loading branch information
2heal1 authored Nov 11, 2024
1 parent 1a80706 commit 85990e2
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changeset/fair-plums-live.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@module-federation/dts-plugin': patch
---

fix(dts-plugin): hold the broker server if the remote not start locally
15 changes: 13 additions & 2 deletions packages/dts-plugin/src/server/DevServer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -314,8 +314,19 @@ export class ModuleFederationDevServer {
'warn',
);

this._subscriberWebsocketMap[identifier] &&
this._subscriberWebsocketMap[identifier].close();
this._subscriberWebsocketMap[identifier]?.close();
delete this._subscriberWebsocketMap[identifier];
});

this._subscriberWebsocketMap[identifier].on('error', (event) => {
if ('code' in event && event.code === 'ETIMEDOUT') {
fileLog(
`Can not connect ${JSON.stringify(remote)}, please make sure this remote is started locally.`,
MF_SERVER_IDENTIFIER,
'warn',
);
}
this._subscriberWebsocketMap[identifier]?.close();
delete this._subscriberWebsocketMap[identifier];
});
}
Expand Down

0 comments on commit 85990e2

Please sign in to comment.