Skip to content

Commit

Permalink
fix: when module.hot is not truthy (#1451)
Browse files Browse the repository at this point in the history
  • Loading branch information
jzendo authored May 10, 2020
1 parent 1afb27a commit ec3447f
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions root.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
};
Expand Down

0 comments on commit ec3447f

Please sign in to comment.