eJuke/Leaflet.Canvas-Markers

Error in Angular 6 app with canvasIconLayer function

Opened this issue · 2 comments

I am using Leaflet.Canvas-Markers in an Angular 6 app working with leaflet 1.3.1 and I get the following error :
ERROR TypeError: leaflet__WEBPACK_IMPORTED_MODULE_5___default.a.canvasIconLayer is not a function

I imported leaflet.canvas-markers.js file in angular.json script field.

deeg commented

I use successfully by doing

import 'leaflet-canvas-marker/dist/leaflet.canvas-markers.js';

in the file where I am using the library after I have imported leaflet.

I found the same problem here. when I use Single Page Apps. this plugin does not work and produces Uncaught TypeError: L.canvasIconLayer is not a function

even though I have added

<script src = 'assets / map / canvas-markers / leaflet.canvas-markers.js'> </ script>

in my header. but the bug still exists.

for the file leaflet.canvas-markers.js I took it from the source Link

but when I try to change the contents of the file from "eaflet.canvas-markers.js" with the source in: Link

perfect, bugs have been resolved.
I wonder why developers make the same 2 files with different contents. and this complicates us.

But I thank you very much for the developer of this plugin that makes my work become lighter and faster. Hopefully, this can help many people.