Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/chilly-experts-walk.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@module-federation/node': patch
---

add optional check while accessing webpack internals
2 changes: 1 addition & 1 deletion packages/node/src/utils/hot-reload.ts
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ export const performReload = async (
}
});
//@ts-ignore
__webpack_require__.federation.instance.moduleCache.clear();
__webpack_require__?.federation?.instance?.moduleCache?.clear();
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NOTE to reviewers: The code above this already clears the module cache of all the registered remotes. This line assumes that the current execution context is within a federated remote built using federation + webpack, which might not be the case

helpers.global.resetFederationGlobalInfo();
globalThis.moduleGraphDirty = false;
globalThis.mfHashMap = {};
Expand Down
Loading