Closed
Description
Description
What you are reporting: BUG
Expected behavior
What you think should happen: The code should work as expected.
Actual behavior
What actually happens: After enabling react-hot-loader/babel
plugin and compiling, some parts of code missing, and only in the production
environment, caused a serious production level issue.
Environment
React Hot Loader version: ^4.12.15
Run these commands in the project folder and fill in their results:
node -v
: v10.15.3npm -v
: 6.4.1
Then, specify:
- Operating system: macOS 10.14
- Browser and version: Chrome 78
Reproducible Demo
Demo here: https://github.com/yujiangshui/hot-loader-replace-issue. Please follow the instruction on README.md.
Metadata
Metadata
Assignees
Labels
No labels
Projects
Milestone
Relationships
Development
- [Snyk] Upgrade react-hot-loader from 4.6.0 to 4.12.18preset-io/superset
- [Snyk] Upgrade react-hot-loader from 4.3.12 to 4.12.20novalina26/anchor
- [Snyk] Upgrade react-hot-loader from 4.12.12 to 4.13.1TheJ-Erk400/devaccownt
- [Snyk] Upgrade react-hot-loader from 4.12.12 to 4.13.1TheJ-Erk400/devaccownt
- [Snyk] Upgrade: react, react-dom, asn1-ber, electron-debug, history, react-animated-css, react-copy-to-clipboard, react-hot-loader, react-json-view, react-motion-loop, react-redux, redux, redux-thunk, semantic-ui-css, source-map-supportkalbroni7/fairy-wallet
- [Snyk] Upgrade: react-dom, asn1-ber, electron-debug, history, react-animated-css, react-copy-to-clipboard, react-hot-loader, react-json-view, react-motion-loop, redux, redux-thunk, semantic-ui-css, source-map-supportkalbroni7/fairy-wallet
Activity
theKashey commentedon Nov 1, 2019
Documentation many times points on the specific on
hot
-export default hot(App)
.compose
And in production
hot
magically disappears, leaving only the "right argument", while is empty in your case.yujiangshui commentedon Nov 1, 2019
@theKashey thank you for your reply. I have to say that I am not familiar with hot-loader before, and previously in our code use
compose
wrapperhot(module)
(maybe its wrapper App usage looks like HOC?) and it works (so I thought it likes a function can work withcompose
).But after added another HOC to the
compose
, guess what happened? Still works in development but after releasing crash in a production environment!!You may be familiar with the features and think it reasonable, but I think there must be some improvements that can make hot-loader better? Maybe crash in the beginning or give a tip? or just close this issue.
BTW, I couldn't get your points in the last sentence:
Actually, in my case, it looks like at least keep one HOC, and that's the reason why we didn't have any issues before, because we only had one HOC here.
Anyway, thank you.
theKashey commentedon Nov 1, 2019
The logic is quite simple, with 3 use cases for
hot
- https://github.com/gaearon/react-hot-loader/blob/master/src/babel.prod.js#L70Something is not working for use cases we haven't predicted and test.
If you cant change your code to an expected version(
export default hot(App)
) - just disable babel plugin in productionyujiangshui commentedon Nov 1, 2019
Absolutely can understand, there are so many different use cases outside.
Just addressed this issue today, next Monday will upgrade to the recommended
export default hot(App)
way.Thanks again, should I close this issue?
theKashey commentedon Nov 1, 2019
Not yet. Your case should be added to the tests, so keep it open until then
fix: production babel plugin might perform eager replacement, fixes #…