-
Notifications
You must be signed in to change notification settings - Fork 801
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
Error in [email protected] after upgrade react 16 #643
Comments
+1 |
It uses React internals no longer exposed in React 16, I have to check how to do it now with @gaearon. |
Yes, these internals don't exist anymore. 1.x will not work with React 16. Please try to see if 3.x works for you. If it doesn't file issues. Now that we have a new core I think we can take another look at what needs to be exposed for hot reloading. |
@gaearon 3.x still in beta, I didn't want to use it |
The "beta" label there just means that nobody found time to do the job of updating docs etc. 3.x is much more stable than 1.x ever was. |
hi @gaearon (love your work and thank you!), i actually don't want to upgrade to 3.x because it requires so many other changes to our codebase (for example, figuring out how to appropriately adding that said, i'd happily fork 1.x and make minor modifications if that were all that was necessary to fix the |
@noahgrant - I am currently on duty and I still have a hope that we could solve problems with decorators, compositions and other stuff RHL cant, but should handle. Handle code splitting is also not a great problem, but it depends on the loader you use. Popular repos does not support RHL, but it is possible to
It is hard to make a good advice which loader you should use, as long the best ones were just named as "not usable". I know only 2 loaders with good
The good part: the interface is always almost same. |
thanks @theKashey, but i'm not actually looking to upend my existing infrastructure to support different tools. my issue is really that i can't keep using RHL 1.3 when upgrading to react, and, tbh, our existing 1.3 usage is the smoothest dev experience. if there's a way that i can easily replace the mounting function ( upgrading to RHL 3.x, i'm seeing all kinds of odd behavior, like updates navigating back to a previous SPA route, component proxies copying over components but leaving their thank you for your time! |
Thats the difference between v1 and v3?
Behavior of v1 is very, very bad.
So, if you want V3 to behave as V1 - just append each file with this code from V1. But you could not append each file. It is not a good idea. |
i think we might be misunderstanding each other a bit. v3 is unusable for me right now for a few reasons—one is the binding issue after transpiling only to modern browsers. but another reason is simply that our app architecture doesn't easily work with the things v3 requires:
not to mention i'm just getting very inconsistent behavior from reloading, like when it hot reloads once and then refreshes on the next save. so, now back to your other point:
this is not my experience—in fact, relative to the issues i highlighted above, i will gladly take any of v1's shortcomings. v3 is impossible to use right now, and v1 seems to fail only because it doesn't know how to mount in react 16. if there is a modestly easy way to plug in a so, given this, how can we replace thank you again for your time! |
Forget about V1. It is easier to make V3 working as V1 that to keep it alive.
if(typeof React !== 'undefined'){
// self accept all `react` modules
module.hot.accept(function(){});
module.exports.forEach( module => {
if(typeof module==='function'){
try{
React.createElement(module); // this triggers react-proxy
}catch(e){}
}
});
// code is not tested PS: And next you If one good day one good one will create babel rules to detect possibilities of safe-self-accepted of a module - it will change the game rules. But for now, it is too dangerous. PS: v3 is unusable for me right now for a few reasons—one is the binding issue after transpiling only to modern browsers. |
thanks, @theKashey. to be honest, i'm not sure i understood the statements that were written in your PS above, but unless i can use v3 with un-transpiled es6, it doesn't matter. i'll try to work on it at some point. in the meantime, i think i'll have to stay on React v15... |
Same shit :) |
Currently It looks like further development of React 16 is meaningless, while his ecosysyem not ready to use him |
For posterity, I ended up really hacking together a solution to use v1 with React 16.
if (process.env.NODE_ENV !== 'production') {
window.rootComponent = myRootComponent;
}
'deepForceUpdate(React)(window.rootComponent);', This isn't optimal, of course, but has allowed us to maintain the productivity benefits of RHL (v1) while also being able to upgrade to React 16. Just wanted to post here in case other people are having the same problems. |
If you are reporting a bug or having an issue setting up React Hot Loader, please fill in below. For feature requests, feel free to remove this template entirely.
Description
ERROR in ./src/client/containers/App/index.js
Module not found: Error: Can't resolve 'react/lib/ReactMount' in '/Users/apple/blahblahblag/src/client/containers/App'
@ ./src/client/containers/App/index.js 1:304-335
@ ./src/client/routes.jsx
@ ./src/client/index.js
@ multi (webpack)-dev-server/client?http://0.0.0.0:8050 webpack/hot/dev-server babel-polyfill ./src/client/index.js
What you are reporting:
Error
Expected behavior
What you think should happen:
I've just updated before react v16, this wasn't earlier
What actually happens:
error
Environment
React Hot Loader version:
"react-hot-loader": "^1.3.1",
Run these commands in the project folder and fill in their results:
node -v
:npm -v
:Then, specify:
macos
chrome latest
Reproducible Demo
The text was updated successfully, but these errors were encountered: