Leaflet 2.0 Alpha

The first alpha release of the forthcoming major version of LeafletJS is out.

This release marks a major modernization of the Leaflet codebase. We’ve dropped support for Internet Explorer, removed legacy methods and polyfills, adopted modern standards like Pointer Events, and now publish Leaflet as an ESM module. The global L is no longer part of the core package (though it’s still available in the bundled version leaflet-global.js for backward compatibility).

While the release doesn’t include any significant new features (not that there’s anything wrong with that), some breaking changes will be relevant to the majority of Leaflet developers:

  • The removal of factory methods; instead of L.Map("map"), you will directly import and instantiate the Map class with new Map("map").
  • Mouse and touch events have been replaced with Pointer events, making it easier to build web maps for devices with varying input methods.
  • Leaflet is now published as an ESM module, you can now import Leaflet components with import { Map } from "leaflet";.

There’s no timeline for the final release yet. Currently, the version milestone only has one open ticket, so this is a good time to upgrade your apps and plugins. There is the Leaflet V1 Polyfill for those who want to upgrade to Leaflet 2 but don’t want to fix breaking changes in their applications.