wp-plugin-leaflet-map icon indicating copy to clipboard operation
wp-plugin-leaflet-map copied to clipboard

Leaflet V2

Open bozdoz opened this issue 4 months ago • 5 comments

https://leafletjs.com/2025/05/18/leaflet-2.0.0-alpha.html

Looks huge: Remove all L use, and import via ESM instead. (only if using v2!)

bozdoz avatar Aug 18 '25 02:08 bozdoz

cc @hupe13

bozdoz avatar Aug 18 '25 02:08 bozdoz

@bozdoz I’m interested in helping. I guess a bundler setup required to work with the ESM nodejs package? That’s a somewhat opinionated topic. Consider using wp-scripts—it could be useful if you plan to add Gutenberg blocks later. https://developer.wordpress.org/block-editor/reference-guides/packages/packages-scripts/

vegetable-bits avatar Oct 07 '25 12:10 vegetable-bits

@bozdoz I can help you in testing. In any case, we must offer both options: Leaflet 1.9.4 and 2.0. My WordPress plugin depends on other Leaflet plugins, and those must also be migrated.

hupe13 avatar Oct 07 '25 13:10 hupe13

I'm thinking of just creating a proxy for v1 to work automatically with v2, and require the use of the leaflet-global script:

See:

https://codepen.io/bozdoz/pen/EaVOegY?editors=0010

That's using https://unpkg.com/[email protected]/dist/leaflet-global.js

Otherwise, I'm not entirely sure how to handle both v1 (global and cjs) and v2 (ESM)

bozdoz avatar Oct 07 '25 19:10 bozdoz

@bozdoz If that works, why not. The simplistic style of the plugin is his best and strongest feature 🥇

Will you load the package with unpkg? I am from europe and we always try to keep external domain requests als low as possible because of GDPR. So I really hope you continue to service the script from your plugin.

vegetable-bits avatar Oct 09 '25 09:10 vegetable-bits