React-hot-loader: Unnecessary Error Logging on Valid Config

Created on 5 Jun 2019  路  3Comments  路  Source: gaearon/react-hot-loader

Recently if "hot" is turned off but you are in development mode, react-hot-loader starts logging

React-Hot-Loader: misconfiguration detected, using production version in not production environment.

This is not actually a misconfiguration for all cases. Devs should have the option to turn off hot reloading during development and it makes sense to just have react-hot-loader fall back to production mode. Also, these errors pop up all over the place during testing unless you have your NODE_ENV explicitly set to 'test'. I'm also not sure what the purpose of the logs are since if hot is turned off, react hot loader should not interfere at all.

Most helpful comment

hot is turned off, react hot loader should not interfere at all.

The idea is to explain why it does not work as expected :)

An easy way to fix - dont use RHL if you are not going to

const ExportedApp = process.env.NODE_ENV === 'development'
  ? hot(App) // error is thrown by `hot`
  : App;

export default App;

```

All 3 comments

hot is turned off, react hot loader should not interfere at all.

The idea is to explain why it does not work as expected :)

An easy way to fix - dont use RHL if you are not going to

const ExportedApp = process.env.NODE_ENV === 'development'
  ? hot(App) // error is thrown by `hot`
  : App;

export default App;

```

Unfortunately we have a lot of react roots so doing that workaround at each one is going to add a lot of confusion. We would need our own hoc that does this.

Feel free to copy-paste root/hot sources and make it work for you.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

JamesIves picture JamesIves  路  4Comments

Anahkiasen picture Anahkiasen  路  5Comments

niba picture niba  路  4Comments

lemonmade picture lemonmade  路  3Comments

mtscout6 picture mtscout6  路  3Comments