miguelcobain/ember-leaflet

would like to Dynamic Import (lazyload) leaflet package

MrRobz opened this issue · 2 comments

Is there a way to Dynamic Import leaflet.js package in my ember app.
Is it possible with ember-auto-import?

I was thinking of dynamically loading leaflet.js and then calling ember-leaflet components like {{{#leaflet-map}}.
Right now leaflet.js get added in vendor.js, but I don't want it to load it on app bootup.

Did some digging, was able to find that, there is an option to pass excludeJS which does not add leaflet.js to vendor.
But still facing a problem. leaflet-assets initializer expects leaflet's-L to be present on initialize.
But I am trying to dynamically load it lazily to the app. Problem since initializer code gets called on app load and it expects leaflet to be loaded.

Creating a PR to fix this.