Skip to content

Commit 8336150

Browse files
authored
fix: gracefully handle failed capture of exports (#546)
1 parent 800f8ba commit 8336150

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

client/utils/retry.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ function runWithRetry(callback, maxRetries) {
22
function executeWithRetryAndTimeout(currentCount) {
33
try {
44
if (currentCount > maxRetries - 1) {
5-
console.warn('[React Refresh] Failed set up the socket connection.');
5+
console.warn('[React Refresh] Failed to set up the socket connection.');
66
return;
77
}
88

lib/runtime/RefreshUtils.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,13 @@ var Refresh = require('react-refresh/runtime');
77
* @returns {*} An exports object from the module.
88
*/
99
function getModuleExports(moduleId) {
10-
var exportsOrPromise = __webpack_require__.c[moduleId].exports;
10+
var maybeModule = __webpack_require__.c[moduleId];
11+
if (typeof maybeModule === 'undefined') {
12+
console.warn('[React Refresh] Failed to get exports for module: ' + moduleId + '.');
13+
return {};
14+
}
15+
16+
var exportsOrPromise = maybeModule.exports;
1117
if (typeof Promise !== 'undefined' && exportsOrPromise instanceof Promise) {
1218
return exportsOrPromise.then(function (exports) {
1319
return exports;

0 commit comments

Comments
 (0)