Friday 14 April 2017

How to avoid multiple copies of react when both module and project are bundled with webpack 2

I have made a module named as services which serves the loading bar, notifications and flash banner etc to other projects. I bundled this module by babel and it was running perfect but as the requirements kept growing for services so i have to bundled this from webpack-2 because of css type issues. I bundled it as a library. But when i uses notifications which are imported from services, it gives such warnings

Uncaught Error: addComponentAsRefTo(...): Only a ReactOwner can have refs. You might be adding a ref to a component that was not created inside a component's `render` method, or you have multiple copies of React loaded 

and

index.js:25 Uncaught TypeError: Cannot read property 'componentWillEnter' of undefined

PS: I have already tried resolve.alias and externals properties of webpack but no use :( Any suggestions Please?



via dev123

No comments:

Post a Comment