Leaflet: "esm" Leaflet has no default export

Created on 13 Feb 2018  Â·  1Comment  Â·  Source: Leaflet/Leaflet

How to reproduce

  • Leaflet version I'm using:

GitHub master

What behaviour I'm expecting and which behaviour I'm seeing

When using Rollup, which respects the "module" declaration in the latest package.json, other packages that use import L from 'leaflet'; (such as leaflet-virtual-grid) don't bundle because the leaflet-src.esm.js file doesn’t declare a default export.

Instead, other packages need to change to import * as L from 'leaflet'; or import specific symbols that they want.

I'm not sure if you want to preserve having import L from 'leaflet' work.

I just noticed this and wanted to raise it up.

Minimal example reproducing the issue

  • [ ] this example is as simple as possible
  • [ ] this example does not rely on any third party code

Using http://leafletjs.com/edit.html or any other jsfiddle-like site.

docs help wanted

Most helpful comment

I think the current way is acceptable, and preserving import L from 'leaflet' it is not really worth it at this point.

We need to make a note of this somehow, so devs are aware that import * as L from 'leaflet' is the advised way to impor Leaflet. Maybe something at https://github.com/Leaflet/Leaflet/blob/master/build/docs-misc.leafdoc ?

>All comments

I think the current way is acceptable, and preserving import L from 'leaflet' it is not really worth it at this point.

We need to make a note of this somehow, so devs are aware that import * as L from 'leaflet' is the advised way to impor Leaflet. Maybe something at https://github.com/Leaflet/Leaflet/blob/master/build/docs-misc.leafdoc ?

Was this page helpful?
0 / 5 - 0 ratings