Skip to content

Commit

Permalink
fix: No HMR missing error in SSR
Browse files Browse the repository at this point in the history
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
  • Loading branch information
xD3CODER committed May 17, 2019
1 parent c5bcd40 commit 956e52b
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions index.js
Expand Up @@ -2,12 +2,12 @@

if (process.env.NODE_ENV === 'production') {
module.exports = require('./dist/react-hot-loader.production.min.js');
} else if (!module.hot) {
console.error('React-Hot-Loader: Hot Module Replacement is not enabled');
module.exports = require('./dist/react-hot-loader.production.min.js');
} else if (typeof window === 'undefined') {
// this is just server environment
module.exports = require('./dist/react-hot-loader.production.min.js');
} else if (!module.hot) {
console.error('React-Hot-Loader: Hot Module Replacement is not enabled');
module.exports = require('./dist/react-hot-loader.production.min.js');
} else {
var evalAllowed = false;
try {
Expand Down

0 comments on commit 956e52b

Please sign in to comment.