Skip to content

Commit f3990a5

Browse files
authored
fix: remove usage of destructuring for IE11 compat (#503)
1 parent 45c3b6e commit f3990a5

File tree

4 files changed

+10
-10
lines changed

4 files changed

+10
-10
lines changed

client/ErrorOverlayEntry.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/* global __react_refresh_error_overlay__, __react_refresh_socket__, __resourceQuery */
22

3-
const { handleError, handleUnhandledRejection } = require('./utils/errorEventHandlers.js');
3+
const events = require('./utils/errorEventHandlers.js');
44
const formatWebpackErrors = require('./utils/formatWebpackErrors.js');
55
const runWithPatchedUrl = require('./utils/patchUrl.js');
66
const runWithRetry = require('./utils/retry.js');
@@ -83,11 +83,11 @@ if (process.env.NODE_ENV !== 'production') {
8383
__react_refresh_socket__.init(compileMessageHandler, __resourceQuery);
8484
}, 3);
8585
// Registers handlers for runtime errors
86-
handleError(function handleError(error) {
86+
events.handleError(function handleError(error) {
8787
hasRuntimeErrors = true;
8888
__react_refresh_error_overlay__.handleRuntimeError(error);
8989
});
90-
handleUnhandledRejection(function handleUnhandledPromiseRejection(error) {
90+
events.handleUnhandledRejection(function handleUnhandledPromiseRejection(error) {
9191
hasRuntimeErrors = true;
9292
__react_refresh_error_overlay__.handleRuntimeError(error);
9393
});

overlay/components/CompileErrorTrace.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
const ansiHTML = require('ansi-html-community');
22
const entities = require('html-entities');
33
const theme = require('../theme.js');
4-
const { formatFilename } = require('../utils.js');
4+
const utils = require('../utils.js');
55

66
ansiHTML.setColors(theme);
77

@@ -26,7 +26,7 @@ function CompileErrorTrace(document, root, props) {
2626
.replace(/^(.*:)\s.*:(\s.*)$/, '$1$2');
2727

2828
if (errorParts[0]) {
29-
errorParts[0] = formatFilename(errorParts[0]);
29+
errorParts[0] = utils.formatFilename(errorParts[0]);
3030
}
3131

3232
errorParts.unshift(errorMessage);

overlay/components/RuntimeErrorStack.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
const ErrorStackParser = require('error-stack-parser');
22
const theme = require('../theme.js');
3-
const { formatFilename } = require('../utils.js');
3+
const utils = require('../utils.js');
44

55
/**
66
* @typedef {Object} RuntimeErrorStackProps
@@ -59,7 +59,7 @@ function RuntimeErrorStack(document, root, props) {
5959
const fileName = document.createElement('div');
6060
fileName.innerHTML =
6161
'  ' +
62-
formatFilename(currentStack.fileName) +
62+
utils.formatFilename(currentStack.fileName) +
6363
':' +
6464
currentStack.lineNumber +
6565
':' +

overlay/index.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ const RuntimeErrorHeader = require('./components/RuntimeErrorHeader.js');
33
const CompileErrorContainer = require('./containers/CompileErrorContainer.js');
44
const RuntimeErrorContainer = require('./containers/RuntimeErrorContainer.js');
55
const theme = require('./theme.js');
6-
const { debounce, removeAllChildren } = require('./utils.js');
6+
const utils = require('./utils.js');
77

88
/**
99
* @callback RenderFn
@@ -176,7 +176,7 @@ function render() {
176176
currentFocusId = currentFocus.id;
177177
}
178178

179-
removeAllChildren(root);
179+
utils.removeAllChildren(root);
180180

181181
if (currentCompileErrorMessage) {
182182
currentMode = 'compileError';
@@ -300,7 +300,7 @@ function showRuntimeErrors(errors) {
300300
* @param {Error[]} errors
301301
* @returns {void}
302302
*/
303-
const debouncedShowRuntimeErrors = debounce(showRuntimeErrors, 30);
303+
const debouncedShowRuntimeErrors = utils.debounce(showRuntimeErrors, 30);
304304

305305
/**
306306
* Detects if an error is a Webpack compilation error.

0 commit comments

Comments
 (0)