From 956e52bc93febef7a39ad8c047774170093ca77b Mon Sep 17 00:00:00 2001 From: Nathan KREMER Date: Fri, 17 May 2019 14:27:38 +0200 Subject: [PATCH] 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 --- index.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/index.js b/index.js index 905f31b50..cd09abefe 100644 --- a/index.js +++ b/index.js @@ -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 {