File tree 1 file changed +9
-4
lines changed
1 file changed +9
-4
lines changed Original file line number Diff line number Diff line change @@ -2,19 +2,24 @@ if (module.hot) {
2
2
var hot = require ( './index' ) . hot ;
3
3
var cache = require . cache ;
4
4
5
- if ( ! module . parents || ! module . parents [ 0 ] ) {
5
+ if ( ! module . parents || module . parents . length === 0 ) {
6
6
throw new Error (
7
7
'React-Hot-Loader: `react-hot-loader/root` is not supported on your system. ' +
8
8
'Please use `import {hot} from "react-hot-loader"` instead' ,
9
9
) ;
10
10
}
11
11
// access parent
12
12
var parent = cache [ module . parents [ 0 ] ] ;
13
- // remove itself from a cache
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
14
20
delete cache [ module . id ] ;
15
21
// setup hot for caller
16
-
17
- exports . hot = hot ( Object . assign ( { id : parent . i } , parent ) ) ;
22
+ exports . hot = hot ( parent ) ;
18
23
} else {
19
24
// prod mode
20
25
exports . hot = function ( a ) {
You can’t perform that action at this time.
0 commit comments