Skip to content

Commit 956e52b

Browse files
authored
fix: No HMR missing error in SSR
The second condition is triggered in a server environment resulting in the error message `React-Hot-Loader: Hot Module Replacement is not enabled` Invert the two condition fixes this behavior
1 parent c5bcd40 commit 956e52b

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

Diff for: index.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@
22

33
if (process.env.NODE_ENV === 'production') {
44
module.exports = require('./dist/react-hot-loader.production.min.js');
5-
} else if (!module.hot) {
6-
console.error('React-Hot-Loader: Hot Module Replacement is not enabled');
7-
module.exports = require('./dist/react-hot-loader.production.min.js');
85
} else if (typeof window === 'undefined') {
96
// this is just server environment
107
module.exports = require('./dist/react-hot-loader.production.min.js');
8+
} else if (!module.hot) {
9+
console.error('React-Hot-Loader: Hot Module Replacement is not enabled');
10+
module.exports = require('./dist/react-hot-loader.production.min.js');
1111
} else {
1212
var evalAllowed = false;
1313
try {

0 commit comments

Comments
 (0)