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

Using leaflet-ajax with Rails #53

Open
kaimantsch opened this issue Apr 8, 2018 · 1 comment
Open

Using leaflet-ajax with Rails #53

kaimantsch opened this issue Apr 8, 2018 · 1 comment

Comments

@kaimantsch
Copy link

Discussion: Rails

Has anyone tried to get this working with Rails? I've included leaflet-ajax.js in the asset pipeline (vendor/assets/leaflet/leaflet-ajax.js) and the failure point is:

var L = global.L || require('leaflet');

Console output:

leaflet-ajax.self-926b03b1a13f4f48082577d5eec645d52c1001d3b6014e43024670c27c78ea7e.js?body=1:1 Uncaught Error: Cannot find module 'leaflet'
    at s (leaflet-ajax.self-926b03b1a13f4f48082577d5eec645d52c1001d3b6014e43024670c27c78ea7e.js?body=1:1)
    at leaflet-ajax.self-926b03b1a13f4f48082577d5eec645d52c1001d3b6014e43024670c27c78ea7e.js?body=1:1
    at Object.<anonymous> (leaflet-ajax.self-926b03b1a13f4f48082577d5eec645d52c1001d3b6014e43024670c27c78ea7e.js?body=1:387)
    at Object.4../ajax (leaflet-ajax.self-926b03b1a13f4f48082577d5eec645d52c1001d3b6014e43024670c27c78ea7e.js?body=1:520)
    at s (leaflet-ajax.self-926b03b1a13f4f48082577d5eec645d52c1001d3b6014e43024670c27c78ea7e.js?body=1:1)
    at e (leaflet-ajax.self-926b03b1a13f4f48082577d5eec645d52c1001d3b6014e43024670c27c78ea7e.js?body=1:1)
    at leaflet-ajax.self-926b03b1a13f4f48082577d5eec645d52c1001d3b6014e43024670c27c78ea7e.js?body=1:1
  1. In this context, I'm not sure which "require" is being used. This article was somewhat helpful along these lines: Stackoverflow link. Is this distrib not designed to be run in a browser?

  2. Is there a "module" for leaflet that needs to included somewhere? Any number of ways of referencing leaflet.js did not seem to work. (Passing urls etc.)

I'm sure there's some basic js ignorance on my part here, but I can't imagine I'm the only one to try this. Thanks for the help!

@calvinmetcalf
Copy link
Owner

yeah you need to be including leaflet as well (And first) i'm assuming in your asset pipeline but I'm not very familiar with rails

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