React-hot-loader: Dev version of <AppContainer> used with NODE_ENV=test

Created on 11 Oct 2016  路  3Comments  路  Source: gaearon/react-hot-loader

Not sure if this is a misunderstanding/misconfiguration on my part, but while generating code coverage with Istanbul I'm seeing:

React Hot Loader: It appears that "react-hot-loader/patch" did not run immediately before the app started. Make sure that it runs before any other code. For example, if you use Webpack, you can add "react-hot-loader/patch" as the very first item to the "entry" array in its config. Alternatively, you can add require("react-hot-loader/patch") as the very first line in the application code, before any other imports.

It looks to me that with NODE_ENV=test we're using the dev version of <AppContainer>.

Should that be something like the following?

if (!module.hot || process.env.NODE_ENV === 'production') {
  module.exports = require('./AppContainer.prod');
} else {
  module.exports = require('./AppContainer.dev');
}

All 3 comments

Yep, you're right. Really we should never use the dev version of AppContainer or patch whenever module.hot isn't present. I'll try to fix this and release a beta 6 tonight. Thanks!

Out in 3.0.0-beta.6

Works as advertised now. Thanks for the quick turnaround!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jljorgenson18 picture jljorgenson18  路  3Comments

theKashey picture theKashey  路  3Comments

rockchalkwushock picture rockchalkwushock  路  3Comments

Opty1712 picture Opty1712  路  4Comments

ghost picture ghost  路  3Comments