zakjan / mapbox-gl-draw-geodesic

Geodesic plugin for Mapbox GL Draw
https://zakjan.github.io/mapbox-gl-draw-geodesic/
MIT License
51 stars 8 forks source link

Upgrading mapbox-gl-draw version from 1.3 to 1.4 throws an error with Constants in Geodesic #21

Closed aninikol closed 11 months ago

aninikol commented 1 year ago

With the upgrade of mapbox-gl-draw from 1.3 to 1.4 the Constants can be accessed directly from the Mapbox object so there is no need to import from src/constants which is causing an error when using the mapbox-gl-draw-geodesic specifically to the file mapbox-gl-draw-geodesic/src/constants.js. Here is the PR of mapbox-gl-draw change. Code should be updated in order for the geodesic package works with the 1.4 version of mapbox-gl-draw

zakjan commented 1 year ago

Thanks for noticing! Could you make a PR, please?

aninikol commented 1 year ago

PR #24

zakjan commented 1 year ago

Constants can be accessed directly from the Mapbox object so there is no need to import from src/constants

There are other objects accessed from mapbox-gl-draw as well. The full list is visible by running npm run dev. After upgrading mapbox-gl-draw, Rollup complains about missing external dependencies.

https://rollupjs.org/guide/en/#warning-treating-module-as-external-dependency
@mapbox/mapbox-gl-draw/src/constants (imported by src/constants.js)
@mapbox/mapbox-gl-draw/src/lib/double_click_zoom (imported by src/modes/draw_circle.js)
@mapbox/mapbox-gl-draw/src/lib/common_selectors (imported by src/modes/draw_circle.js)
@mapbox/mapbox-gl-draw/src/lib/create_vertex (imported by src/utils/create_geodesic_geojson.js)

It seems that the upgrade is more complex.

zakjan commented 11 months ago

Done in 2.3.0.