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

es6 import nevertheless exposes the whole library #5704

Closed
germsb opened this issue Aug 10, 2017 · 1 comment
Closed

es6 import nevertheless exposes the whole library #5704

germsb opened this issue Aug 10, 2017 · 1 comment

Comments

@germsb
Copy link

germsb commented Aug 10, 2017

  • Leaflet version I'm using: >1.1.0

In the release note you say:

For users upgrading to this release, this change should not make a difference, while it offers the possibility to import individual parts of Leaflet individually if your app is built with ES6.

Ok, let's go.

import {Map} from 'leaflet'; //npm package
let map = new Map(id,{zoom:0, center:{lat:0,lng:0}});

It works but in the browser console, i see the global L with all features and when I build my app (webpack), the whole library is injected.

It seems to me that the objective is to reduce the size by eliminating the features that one does not need, I'm wrong ?

@perliedman
Copy link
Member

Hi, thanks for reporting.

This is ongoing work that is not yet completely finished. The main problem at the moment is making sure people can use Leaflet with module imports, but still also use Leaflet plugins that wasn't written with modules or any bundler in mind. That quickly gets tricky.

I'm going to close this for now, and direct you to the discussion in #5620, which hopefully will resolve the issue you're seeing. A similar point is also made in #5489 (comment).

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