question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

L.esri undefined with webpack

See original GitHub issue
  • Browser and version:

ie: Chrome 60

  • Version of Leaflet (L.version):

1.2.0

  • Version of esri Leaflet (L.esri.VERSION):

2.1.1

Steps to reproduce the error:

using

"leaflet": "1.2.0",
"esri-leaflet": "2.1.1",
"webpack": "3.5.3"

This might be a followup problem after #990 esri-leaflet does not override leaflet’s L object now but also does not create the esri property in it.

I’ve tried to debug the initialization proccess and the esri-leaflet-debug.js script runs without producing any error. When the app loads the L.esri is undefined though.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:9 (6 by maintainers)

github_iconTop GitHub Comments

3reactions
jgravoiscommented, Aug 13, 2017

in webpack, you shouldn’t be expecting our plugin to reside within Leaflet’s namespace.

var L = require('leaflet');
var esri = require('esri-leaflet');

esri.basemapLayer('Topographic').addTo(map);

https://github.com/Esri/esri-leaflet-webpack-example/blob/cf53572c1293f3c982a1524482c697284798b857/main.js#L19

1reaction
GeorgeKnapcommented, Aug 14, 2017

@jgravois Thanks. the var esri = require('esri-leaflet'); works. Anyway I would like to dig a bit deeper: I am using ES6 import & typescript. If I import import * as esri from 'esri-leaflet'; the typings provided by esri-leaflet gives me the full L object type with esri property in it:

import esri-type

This is in fact wrong because when compiled to es5 it is just the esri plugin object. esri_obj I believe the typings may be wrong here.

Read more comments on GitHub >

github_iconTop Results From Across the Web

I can't get esri-leaflet to work with ReactJS - Stack Overflow
I can't get esri-leaflet to work with ReactJS --> basemapLayer of undefined · If you use CDN links in the main.html, L is...
Read more >
Esri JS-API 4.13, Webpack, imported classes show up undefined
We are using roughly 50 classes from different packages, but five classes show up undefined, these are the failing imports: import watchUtils ...
Read more >
esri-leaflet - npm
Leaflet plugins for consuming ArcGIS Online and ArcGIS Server services.. Latest version: 3.0.9, last published: 20 days ago.
Read more >
L.esri.FeatureLayer | Esri Leaflet - ArcGIS Developers
L.esri.FeatureLayer is used to visualize, style, query and edit vector geographic data hosted in ... getFeature(<String or Integer> undefined id), Layer ...
Read more >
leaflet - L.esri.query - where is it? - GIS Stack Exchange
L.esri.query is undefined. Initially, I'd just been loading the v1.0 JS file: <script src=" ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found