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

Error when using ESM CDNs - The requested module does not provide an export named 'toLatLngBounds' #1386

Open
gavinr-maps opened this issue Jan 30, 2024 · 0 comments
Assignees

Comments

@gavinr-maps
Copy link
Contributor

gavinr-maps commented Jan 30, 2024

Describe the bug

When trying to load Esri Leaflet via ES Modules via an ESM CDN like esm.sh or esm.run by jsDelivr, there is an error:

Uncaught SyntaxError: The requested module .... does not provide an export named 'toLatLngBounds' ...

Notes:

Reproduction

esm.sh reproduction:

  1. Open https://jsbin.com/nuwoqiyiku/4/edit?html,output
  2. View the developer console
    • Expected: the map loads and no errors
    • Actual:

      Uncaught SyntaxError: The requested module '/v135/leaflet@1.9.4/es2022/leaflet.mjs' does not provide an export named 'toLatLngBounds' (at FeatureGrid.js:3:3)

esm.run reproduction:

  1. Open https://jsbin.com/zuseraz/2/edit?html,output
  2. View the developer console
    • Expected: the map loads and no errors
    • Actual:

      Uncaught SyntaxError: The requested module '/npm/leaflet@1.9.4/+esm' does not provide an export named 'toLatLngBounds' (at +esm:7:265)

Logs

No response

System Info

- Leaflet v1.9.4
- Esri Leaflet v3.0.12

Additional Information

It does look like Leaflet exports as latLngBounds - https://github.com/Leaflet/Leaflet/blob/b2fd591c33785227e0d4036c1a80a00bd2debd53/src/geo/index.js#L2

... so is the fix as simple as changing this:

toLatLngBounds as latLngBounds,

to:

latLngBounds,

?

@gavinr-maps gavinr-maps self-assigned this Feb 20, 2024
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

1 participant