Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dev version of <AppContainer> used with NODE_ENV=test #396

Closed
esturcke opened this issue Oct 11, 2016 · 3 comments
Closed

Dev version of <AppContainer> used with NODE_ENV=test #396

esturcke opened this issue Oct 11, 2016 · 3 comments

Comments

@esturcke
Copy link

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');
}
@calesce
Copy link
Collaborator

calesce commented Oct 13, 2016

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!

calesce added a commit to calesce/react-hot-loader that referenced this issue Oct 14, 2016
Prevents cases where NODE_ENV=test imports the development AppContainer
and patching code. We can leave the NODE_ENV=production check in for
manually opting out. Closes gaearon#396.
calesce added a commit that referenced this issue Oct 14, 2016
Prevents cases where NODE_ENV=test imports the development AppContainer
and patching code. We can leave the NODE_ENV=production check in for
manually opting out. Closes #396.
@calesce
Copy link
Collaborator

calesce commented Oct 14, 2016

Out in 3.0.0-beta.6

@calesce calesce closed this as completed Oct 14, 2016
@esturcke
Copy link
Author

Works as advertised now. Thanks for the quick turnaround!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants