-
Notifications
You must be signed in to change notification settings - Fork 47.2k
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-addons-transition-group creates multiple copies of React #7874
Comments
If the versions of React and the addon match, after deleting node_modules and running npm install you shouldn't get an extra copy of React. npm should just leave the top level React in the module tree. Is that not the case for you? |
@gaearon Yes that is the case but when using webpack to bundle my component I leave React out (as an external) and just bundle The problem however(I am guessing) comes from the fact that I am trying to create a fiddle to see if I can communicate in a more clear way. |
TL;DR -@gaearon This issue & this solution seemed to work for me. Longer version:Issue:The issue is Solution:Declare both |
Yeah, we don't have a good story around UMD bundles referencing addons right now. The plan is to decouple addons completely and then perhaps hand them over to the community because we don't actively maintain them anyway. |
@ajainarayanan I've been having this same problem, but adding |
@grahamvo react.js comes with react alone and react-with-addons.js packages react along with the necessary add-ons. So if you are packaging react-addons-css-transition-group as external dependency in your library you want to use react-with-addons.js in a project where you are using your library. Hope this helps |
I have also encountered the same problem. // webpack.config.js
config.externals = {
'echarts': 'echarts',
'react': 'React',
'react-dom': 'ReactDOM',
'react-router': 'ReactRouter',
'react-addons-transition-group': 'var window.React.addons.TransitionGroup',
'react-addons-css-transition-group': 'var window.React.addons.CSSTransitionGroup',
'react/lib/ReactTransitionGroup': 'var window.React.addons.TransitionGroup',
'react/lib/ReactCSSTransitionGroup': 'var window.React.addons.CSSTransitionGroup',
'history': 'History'
}; <!-- index.html -->
<script src="your cdn/react-with-addons.min.js"></script>
<script src="your cdn/react-dom.min.js"></script>
<script src="your cdn/ReactRouter.min.js"></script> This solves the problem |
Scenario:
react-addons-transition-group
react
in my webpack build process andreact-addons-transition-group
which doesrequire('react/lib/ReactTransitionGroup')
)However when I try to use the react component that I built in another project (angular project using ngReact) where I load React globally for
ngReact
library, it creates an issue as there are multiple copies of React refs-must-have-ownerProblem:
It now comes down to which React I am using. The one I have globally or the one that gets bundled with
react-addons-transition-group
?Has anybody else encountered this issue? Is there a workaround? Is there a plan to make
react
as peer dependency(and not require it directly)? I'm sure that will be a major change but asking it anyways. Please correct me if I have mis-understood the problem in anyways.PS:
Sorry about the previous issue, accidentally hit ENTER and github created the issue.
The text was updated successfully, but these errors were encountered: