How to avoid multiple copies of react when both modules and projects are bundled with webpack 2

I created a module named services

that serves the loading bar, notifications and flash banner, etc. for other projects. I linked this module with babel and it worked flawlessly, but as requirements were constantly expanding for services, so I need to link this to webpack-2 due to css type issues. I linked it as a library. But when I use notifications that are imported from services it gives warnings like this

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 `render` method, or you have multiple copies of React loaded 

      

and

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

      

PS: I've already tried the resolve.alias and externals webpack properties but haven't used :( Any suggestions please?

+3


source to share





All Articles