Skip to content

Commit

Permalink
fix(devtools): fix options undefined cause error (#2401)
Browse files Browse the repository at this point in the history
  • Loading branch information
nyqykk authored Apr 28, 2024
1 parent 3d9435f commit 99b23f7
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changeset/good-toes-beg.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@module-federation/devtools': patch
---

fix(devtools): fix options undefined cause error
2 changes: 1 addition & 1 deletion packages/chrome-devtools/src/utils/chrome/post-message.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const getModuleInfo = (): FederationRuntimePlugin => {
name: 'mf-devtool-getModuleInfo-plugin',
loadRemoteSnapshot({ options, moduleInfo, remoteSnapshot, ...res }) {
const globalSnapshot = helpers.global.getGlobalSnapshot();
if (options.inBrowser) {
if (!options || options.inBrowser) {
window.postMessage(
{
moduleInfo: globalSnapshot,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const chromeDevtoolsPlugin: () => FederationRuntimePlugin = function () {
beforeLoadRemoteSnapshot({ options }) {
const { nativeGlobal } = runtimeHelpers.global;

if (options.inBrowser) {
if (!options || options.inBrowser) {
const realLocalStorage = nativeGlobal.localStorage || localStorage;
const debugModuleInfoStr = realLocalStorage.getItem(
MODULE_DEVTOOL_IDENTIFIER,
Expand Down

0 comments on commit 99b23f7

Please sign in to comment.