Skip to content

Commit 99b23f7

Browse files
authored
fix(devtools): fix options undefined cause error (#2401)
1 parent 3d9435f commit 99b23f7

File tree

3 files changed

+7
-2
lines changed

3 files changed

+7
-2
lines changed

.changeset/good-toes-beg.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@module-federation/devtools': patch
3+
---
4+
5+
fix(devtools): fix options undefined cause error

packages/chrome-devtools/src/utils/chrome/post-message.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ const getModuleInfo = (): FederationRuntimePlugin => {
88
name: 'mf-devtool-getModuleInfo-plugin',
99
loadRemoteSnapshot({ options, moduleInfo, remoteSnapshot, ...res }) {
1010
const globalSnapshot = helpers.global.getGlobalSnapshot();
11-
if (options.inBrowser) {
11+
if (!options || options.inBrowser) {
1212
window.postMessage(
1313
{
1414
moduleInfo: globalSnapshot,

packages/chrome-devtools/src/utils/chrome/snapshot-plugin.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ const chromeDevtoolsPlugin: () => FederationRuntimePlugin = function () {
1616
beforeLoadRemoteSnapshot({ options }) {
1717
const { nativeGlobal } = runtimeHelpers.global;
1818

19-
if (options.inBrowser) {
19+
if (!options || options.inBrowser) {
2020
const realLocalStorage = nativeGlobal.localStorage || localStorage;
2121
const debugModuleInfoStr = realLocalStorage.getItem(
2222
MODULE_DEVTOOL_IDENTIFIER,

0 commit comments

Comments
 (0)