Skip to content

Commit b12b430

Browse files
committed
fix: suppress error message on a server side, fixes #1188
1 parent e28c750 commit b12b430

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

Diff for: index.js

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
'use strict'
22

3-
if (!module.hot || process.env.NODE_ENV === 'production') {
3+
var hasWindow = typeof window !== 'undefined';
4+
5+
if (!module.hot || process.env.NODE_ENV === 'production' || !hasWindow) {
46
module.exports = require('./dist/react-hot-loader.production.min.js');
57
} else {
68
var evalAllowed = false;
@@ -11,7 +13,7 @@ if (!module.hot || process.env.NODE_ENV === 'production') {
1113
}
1214

1315
// RHL needs setPrototypeOf to operate Component inheritance, and eval to patch methods
14-
var jsFeaturesPresent = typeof window !== 'undefined' && !!Object.setPrototypeOf;
16+
var jsFeaturesPresent = !!Object.setPrototypeOf;
1517

1618
if (!jsFeaturesPresent || !evalAllowed) {
1719
// we are not in prod mode, but RHL could not be activated

0 commit comments

Comments
 (0)