Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue with installing/Using #16

Open
henrikmaa opened this issue Oct 27, 2020 · 2 comments
Open

Issue with installing/Using #16

henrikmaa opened this issue Oct 27, 2020 · 2 comments

Comments

@henrikmaa
Copy link

I am having problems with rbush is not defined

steps i did:

  1. npm install https://github.com/IITC-CE/Leaflet.Canvas-Markers.git
  2. require('leaflet-canvas-marker'); also tried import 'leaflet-canvas-marker'

Now i get error: rbush is not defined

Also tried to install rbush in my project.
Am I using this wrong?

Used this code to test

   // Adds a layer
    let ciLayer = L.canvasIconLayer({}).addTo(map);

      // Marker definition
    let marker =  L.marker([58.5578, 29.0087]);

      // Adding marker to layer
    ciLayer.addMarker(marker);

I also deleted node_modules and package-lock and npm install again to make sure...

@johnd0e
Copy link

johnd0e commented Oct 27, 2020

After npm install have you got dist/leaflet.canvas-markers.js file (14436 b size)?

@johnd0e
Copy link

johnd0e commented Oct 27, 2020

Also please note that original 'build system' is rather dumb and the only tested way to use it - is following original guide literally: https://github.com/IITC-CE/Leaflet.Canvas-Markers#installation-and-basic-usage.

I'm not the author of that code, and in my project I use main source file directly https://github.com/IITC-CE/Leaflet.Canvas-Markers/blob/master/src/plugin/leaflet.canvas-markers.js (after including rbush 2.0.2).

I see that you prefer to install the plugin with require. I cannot tell if that should work.
So if that is not working - you can try to fix webpack.config.js or Leaflet.Canvas-Markers/src/_full.js

var rbush = require("rbush");
var factory = require("./plugin/leaflet.canvas-markers");
window.L.CanvasIconLayer = factory(L);
window.rbush = rbush;

P.S.
Feel free to open PR if you will be able to solve your issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants