Created by: maomaoZH
set react and react-dom alias in webpack to avoid loading twice react during developing. This issue has been discussed, see here https://github.com/facebookincubator/create-react-app/issues/675. I have tested with my app locally. The duplicated react issue is gone after set up alias.
Activity
Created by: facebook-github-bot
Thank you for your pull request and welcome to our community. We require contributors to sign our Contributor License Agreement, and we don't seem to have you on file. In order for us to review and merge your code, please sign up at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need the corporate CLA signed.
If you have received this in error or have any questions, please contact us at cla@fb.com. Thanks!
added CLA Signed label
Created by: gaearon
I feel like in a way this just works around the problem instead of solving it. I would prefer it we completely failed the build with multiple
react
/react-dom
s and printed where they are in the tree so you could figure out how to deduplicate them and fix the root issue.Created by: maomaoZH
Okay, let me explain the case that we've been facing. Then we may understand/talk the way how we resolve it. After that, I can improve this pull request.
First, we have an application which is obviously created by create-react-app and using a dependency that we have been developing. That dependency contains our React UI components. Therefore, we need to link the dependency to our main application during the development. So this case cause multiple copies of React issue.
I think that we may resolve the issue in this way that we have in this branch. Besides that, there is such a workaround, here. But the latter one would be a real workaround than the changes we have here in my opinion.
Therefore, I'm wondering how we can resolve the issue. Could you explain that?
Created by: gaearon
We are tracking the "npm link" use case in https://github.com/facebookincubator/create-react-app/issues/1107. Not sure if there's any great solutions for it.
Ideally I'd like us to fix https://github.com/facebookincubator/create-react-app/issues/1333. This wouldn't solve "linking" per se, but it would add a supported way to develop components alongside the app. Would that satisfy your use case?
The reason I'm not very happy with aliasing
react
andreact-dom
in particular is because the problem with links still exists: we just work around it for two particular packages. You may still bump into it with other dependencies. So I'd like to see if we can solve this more holistically.Created by: gaearon
Related: https://github.com/facebookincubator/create-react-app/issues/3883
Seems like this is actually the root of the problem. Pardon the module resolution pun.
added stale label