Multiple import on the same namespace (Extend library)

Probably the title is wrong, I still have to figure out what I am missing of this.

So I have an application which as leaflet running and everything is fine.

Now I want to be able to add any of the existing project created to extend the functionality of leaflet.

Example: LeafLet + Leaflet.EasyButton

Example 2: LeafLet + leaflet.offline

Now I find myself in the situation on which I have to write the imports:

import leaflet from 'leaflet';
import leaflet from 'leaflet-easybutton';

Of course I can’t because of the douled namespace, now my question is how can I use the second library as an extension of the first one?

Going back to the first example, using the example given on github, I should be able to do something like this:

    leaflet.easyButton('fa-globe', function(btn, map){

But I cannot figure out how to extend the first library with the second in order to be able to use it as I explained.

I know it is a silly question, but I was not able to solve it in hours.

Thanks to whoever can help me.

I’ve solved the problem with the easy-button library simply importing it like:

import 'leaflet-easybutton';

and using it as expected.

I tried using the same approach for both libraries:


The first one I’m able to import it with the code:

import 'leaflet-offline'; 

but then I still cannot use the method described in the git page of that library.

The second one also using the same sintax:

import 'leaflet.offline'; 

Is not even found by ionic, throwing an errore on module not found.

What I’m doing wrong now?

I hope at least the solution I found will help someone.