-
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
React Hot Loader doesn't work if React is external (CDN) #53
Comments
Good catch. We depend on internal In your case, it seems that external packages are being used for React itself, but I think it would be nice to avoid depending on What practical benefit does it give you to use externals in dev? |
Please see if this works for you: Available in 1.0.6. |
Hello @gaearon! That's a great turnaround. :) A reason for asking about this is because, for me, If there's any way to reduce the differences between development and production environments without impacting on their productivity and performance respectively, then I feel that's worth exploring. :) I wonder if Facebook or the React people have been asked about providing some way of accessing |
As they're aiming for smaller API surface I doubt they'd be inclined to do it. There is a devtools hook that can be used to get internal objects (React Chrome DevTools uses it), however this hook is meant to only be set once so it's inconvenient and error-prone to try to use it here. I'll raise an issue though. |
Filed as facebook/react#2797 |
Just wanted to chime in this works great for our project that has React as an external. Thank you! |
@frankychung I'm glad to hear this! |
Davide, can’t find your comment, have you figured it out, or is Github glitching?
|
I had a second look. Basically I wanted to require react+addons without modifying my code (its code that works fine with plain require.js and now i am making it work with webpack too). So i set up an alias { 'react': 'react/addons' } in webpack.config.js but if you do that then again react-hot-loader can't find 'react/lib/ReactMount' anymore. Which makes sense. It's just one more case similar to the previous ones. |
Yeah I also bumped into that before. You can actually work around it in a terrible-ish way: 'react': 'react/addons',
// A workaround for react/lib to be resolved correctly:
'react/addons/lib': 'react/../lib', |
ahaha, my god. I like the hot realoding thing. Its why i am tryin webpack. But the amount of unclean hacks I had to apply is making me sick. Thank you though, nice one. |
Works around hot-module-loader issue gaearon/react-hot-loader#53 where it can't use the compiled version from Canvas. Pinned react at same version as Canvas' (currently 0.12.2)
With |
@gaearon but now appears this; if I use ReactDOM to render (the correct way):
|
@gaearon In product env, use externals, and the addons had to declare like this |
Hi there,
Given:
and:
in the
html
. Then the React Hot Loader doesn't work. I see this in theconsole
:but I don't see the changes getting reflected in the view. It'd work however If I commented out the
externals
configuration and thescript
lines in thehtml
(getting webpack to use NPM react packages).The
console
output is almost the same as above except that[HMR] - 20
was[HMR] - 19
.Any suggestions on how to debug/fix this would be welcome. Confirmation that anyone has successfully used React Hot Loader with external React resources would be great too.
The text was updated successfully, but these errors were encountered: