Commit 9561d66 1 parent af42c1a commit 9561d66 Copy full SHA for 9561d66
File tree 1 file changed +11
-1
lines changed
1 file changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -13,18 +13,28 @@ if (process.env.NODE_ENV === 'production') {
13
13
module . exports . hot . shouldWrapWithAppContainer = true ;
14
14
} else {
15
15
var evalAllowed = false ;
16
+ var evalError = null ;
16
17
try {
17
18
eval ( 'evalAllowed = true' ) ;
18
19
} catch ( e ) {
19
20
// eval not allowed due to CSP
21
+ evalError = e && e . message ? e . message : 'unknown reason' ;
20
22
}
21
23
24
+ // TODO: dont use eval to update methods. see #1273
22
25
// RHL needs setPrototypeOf to operate Component inheritance, and eval to patch methods
23
26
var jsFeaturesPresent = ! ! Object . setPrototypeOf ;
24
27
25
28
if ( ! jsFeaturesPresent || ! evalAllowed ) {
26
29
// we are not in prod mode, but RHL could not be activated
27
- console . warn ( 'React-Hot-Loader is not supported in this environment.' ) ;
30
+ console . warn (
31
+ 'React-Hot-Loader is not supported in this environment:' ,
32
+ [
33
+ ! jsFeaturesPresent && "some JS features are missing" ,
34
+ ! evalAllowed && "`eval` is not allowed(" + evalError + ")"
35
+ ] . join ( ',' ) ,
36
+ '.'
37
+ ) ;
28
38
module . exports = require ( './dist/react-hot-loader.production.min.js' ) ;
29
39
} else {
30
40
module . exports = window . reactHotLoaderGlobal = require ( './dist/react-hot-loader.development.js' ) ;
You can’t perform that action at this time.
0 commit comments