Prevent the duplication of Ionic code

I am trying to develop a npm module using which an user will have an option to choose any UI framework listed down. Its developed using Angular. I included Ionic as one of the framework. When an user chooses the framework all the components will be converted into Ionic UI component. I had to include ionic dependencies and to make the ionic components work. Later, when I try to include npm module as dependency in the ionic application, for components like select and datepicker where there is requirement of popover, I am getting the below error
ERROR TypeError: Cannot read property ‘_getPortal’ of undefined at App.present (vendor.js:187851) at PopoverImpl.present (vendor.js:205957) at Popover.OverlayProxy.createAndPresentOverlay (vendor.js:204614) at Popover.OverlayProxy.present (vendor.js:204593) at (vendor.js:208770) at Select._click (vendor.js:208645) at Object.eval [as handleEvent] ( at handleEvent (vendor.js:13608) at callWithDebugContext (vendor.js:15093) at Object.debugHandleEvent [as handleEvent]