From 5bab43bae0dea96f80e146b42618bde1ddc47785 Mon Sep 17 00:00:00 2001 From: Lenz Weber Date: Wed, 20 Apr 2022 10:05:34 +0200 Subject: [PATCH 1/2] remove eagerness of RefreshUtils to reduce circular dependency errors --- lib/runtime/RefreshUtils.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/lib/runtime/RefreshUtils.js b/lib/runtime/RefreshUtils.js index 98807575..495437b7 100644 --- a/lib/runtime/RefreshUtils.js +++ b/lib/runtime/RefreshUtils.js @@ -55,6 +55,10 @@ function getReactRefreshBoundarySignature(moduleExports) { continue; } + if (key[0] != key[0].toUpperCase()) { + continue; + } + signature.push(key); signature.push(Refresh.getFamilyByType(moduleExports[key])); } @@ -117,6 +121,11 @@ function isReactRefreshBoundary(moduleExports) { continue; } + if (key[0] != key[0].toUpperCase()) { + areAllExportsComponents = false; + continue; + } + // We can (and have to) safely execute getters here, // as Webpack manually assigns harmony exports to getters, // without any side-effects attached. @@ -155,6 +164,10 @@ function registerExportsForReactRefresh(moduleExports, moduleId) { continue; } + if (key[0] != key[0].toUpperCase()) { + continue; + } + var exportValue = moduleExports[key]; if (Refresh.isLikelyComponentType(exportValue)) { var typeID = moduleId + ' %exports% ' + key; From 829e1ad086ec08f3b49a922f2c2eaed53c5f407a Mon Sep 17 00:00:00 2001 From: Lenz Weber Date: Wed, 20 Apr 2022 10:56:59 +0200 Subject: [PATCH 2/2] do not skip default exports --- lib/runtime/RefreshUtils.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/runtime/RefreshUtils.js b/lib/runtime/RefreshUtils.js index 495437b7..d89b5cfc 100644 --- a/lib/runtime/RefreshUtils.js +++ b/lib/runtime/RefreshUtils.js @@ -55,7 +55,7 @@ function getReactRefreshBoundarySignature(moduleExports) { continue; } - if (key[0] != key[0].toUpperCase()) { + if (key !== 'default' && key[0] != key[0].toUpperCase()) { continue; } @@ -121,7 +121,7 @@ function isReactRefreshBoundary(moduleExports) { continue; } - if (key[0] != key[0].toUpperCase()) { + if (key !== 'default' && key[0] != key[0].toUpperCase()) { areAllExportsComponents = false; continue; } @@ -164,7 +164,7 @@ function registerExportsForReactRefresh(moduleExports, moduleId) { continue; } - if (key[0] != key[0].toUpperCase()) { + if (key !== 'default' && key[0] != key[0].toUpperCase()) { continue; }