-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathreactRefresh.js
More file actions
37 lines (35 loc) · 1.11 KB
/
reactRefresh.js
File metadata and controls
37 lines (35 loc) · 1.11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
// Thanks https://github.com/pmmmwh/react-refresh-webpack-plugin
const RefreshUtils = require('./refreshUtils');
const RefreshRuntime = require('react-refresh/runtime');
// Port from https://github.com/pmmmwh/react-refresh-webpack-plugin/blob/main/loader/utils/getRefreshModuleRuntime.js#L29
function refresh(moduleId, webpackHot) {
const currentExports = RefreshUtils.getModuleExports(moduleId);
const fn = (exports) => {
var errorOverlay;
if (typeof __react_refresh_error_overlay__ !== 'undefined') {
errorOverlay = __react_refresh_error_overlay__;
}
var testMode;
if (typeof __react_refresh_test__ !== 'undefined') {
testMode = __react_refresh_test__;
}
RefreshUtils.executeRuntime(
exports,
moduleId,
webpackHot,
errorOverlay,
testMode,
);
};
if (typeof Promise !== 'undefined' && currentExports instanceof Promise) {
currentExports.then(fn);
} else {
fn(currentExports);
}
}
module.exports = {
refresh,
register: RefreshRuntime.register,
createSignatureFunctionForTransform:
RefreshRuntime.createSignatureFunctionForTransform,
};