Closed almgwary closed 7 years ago
Leaflet.SmoothMarkerBouncing is a global dependency. Try:
require('leaflet.smooth_marker_bouncing/leaflet.smoothmarkerbouncing');
worked for me with the following
import 'leaflet';
import 'leaflet.smooth_marker_bouncing/leaflet.smoothmarkerbouncing.js';
Ahmed El Gabri helped me on facebook group
Ahmed El Gabri: I don't use Angular or Iconic but by checking leaflet.smoothmarkerbouncing.js file it's an Immediately Invoked Function Expression that depends on Leaflet being in its current scope & it should be called L
https://github.com/hosuaby/Leaflet.SmoothMarkerBouncing/blob/master/leaflet.smoothmarkerbouncing.js?fref=gc#L33 https://github.com/hosuaby/Leaflet.SmoothMarkerBouncing/blob/master/leaflet.smoothmarkerbouncing.js?fref=gc#L971
So a quick solution that I'd try is to do this
import 'leaflet'; import 'leaflet.smooth_marker_bouncing/leaflet.smoothmarkerbouncing';
And since Leaflet exposes itself as L this should work, don't expect proper typings & stuff because.
- Leaflet is not typed
- It doesn't export anything, you are literally dumping the file into your own.
i want to use Leaflet.SmoothMarkerBouncing in Anuglar2 Ionic2 Typescript i am using
types@leaflet
working code
when importing
leaflet.smoothmarkerbouncing
likeimport * as LSmoothmarkerbouncing from 'leaflet.smooth_marker_bouncing/leaflet.smoothmarkerbouncing.js';
it return LSmoothmarkerbouncing empty object{}
the
leaflet.smooth_marker_bouncing/leaflet.smoothmarkerbouncing.js
file is here