UNPKG

776 BJavaScriptView Raw
1if (module.hot) {
2 var hot = require('./index').hot;
3 var cache = require.cache;
4
5 if (!module.parents || module.parents.length === 0) {
6 throw new Error(
7 'React-Hot-Loader: `react-hot-loader/root` is not supported on your system. ' +
8 'Please use `import {hot} from "react-hot-loader"` instead'
9 );
10 }
11 // access parent
12 var parent = cache[module.parents[0]];
13 if (!parent) {
14 throw new Error(
15 'React-Hot-Loader: `react-hot-loader/root` is not supported on your system. ' +
16 'Please use `import {hot} from "react-hot-loader"` instead'
17 );
18 }
19 // remove self from a cache
20 delete cache[module.id];
21 // setup hot for caller
22 exports.hot = hot(parent);
23} else {
24 // prod mode
25 exports.hot = function(a) {
26 return a;
27 };
28}