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

@3.0.0-beta.4 doesn't work if React is external #364

Closed
awaw00 opened this issue Sep 18, 2016 · 5 comments
Closed

@3.0.0-beta.4 doesn't work if React is external #364

awaw00 opened this issue Sep 18, 2016 · 5 comments

Comments

@awaw00
Copy link

awaw00 commented Sep 18, 2016

Same as #53 but in v3.

@calesce
Copy link
Collaborator

calesce commented Sep 19, 2016

Do you have an example repo I can look at?

You'll need to make sure you import 'react-hot-loader/patch' before any other application code, but after loading React.

@awaw00
Copy link
Author

awaw00 commented Sep 20, 2016

@calesce

Thanks for your reply.

I've created a example repo here, and I found if I used react-router as a external library(use script tag), when components under my routes has changed, react-hot-loader couldn't replace the module exactly.

Sorry for my poor english.

@pedronauck
Copy link

Is happening the same error here 😐 When we put react as external script, hot loader it's getting confusing and can't reload files... We're following the same structure above.

In our case, we need react as externals because webpack is bundling multiple instancies of react, and we get a reference error, so we need it as a external. It's so funny, because this just happened when we put our projects in a monorepo and set the CommonsChunkPlugin.

@calesce
Copy link
Collaborator

calesce commented Oct 1, 2016

@awaw00 thanks for the repo, it looks like the issue is React Router also being external, if you remove it from externals and have it in node_modules, the issue goes away. I'm not sure whether we'll be able to support having non-React component libraries in externals.

@pedronauck do you have a simple reproduce project? as I said above, React being external isn't the problem in @awaw00's project.

@calesce
Copy link
Collaborator

calesce commented Oct 15, 2016

@awaw00 I did some additional testing, and it looks like the issue is React Router being external specifically. I tested with other 3rd-party components (react-datepicker) being external, and they were hot replaced properly.

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

4 participants