From ec3447f163719f0cbe4a0bd0ceccb1059e0beec9 Mon Sep 17 00:00:00 2001 From: jzendo Date: Mon, 11 May 2020 06:20:20 +0800 Subject: [PATCH] fix: when module.hot is not truthy (#1451) --- root.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/root.js b/root.js index 65b702932..44f7f20bb 100644 --- a/root.js +++ b/root.js @@ -17,13 +17,21 @@ if (process.env.NODE_ENV !== 'production') { 'Please use `import {hot} from "react-hot-loader"` instead' ); } + // remove self from a cache delete cache[module.id]; + + // setup hot for caller + exports.hot = hot(parent); + } else { + fallbackHot(); } - // setup hot for caller - exports.hot = hot(parent); } else { // prod mode + fallbackHot(); +} + +function fallbackHot() { exports.hot = function (a) { return a; };