ONSvisual / svelte-maps

Reusable map components for Svelte projects.
23 stars 4 forks source link

Mapbox GL JS bundled instead of imported #1

Open bothness opened 2 years ago

bothness commented 2 years ago

The Mapbox GL JS library is currently bundled rather than imported. This is done for two reasons:

  1. The Svelte REPL imports the latest version of dependencies rather than the versions in the package.json, which means it tries to import v2 (pay-per-use) instead of v1 (open-source).
  2. Mapbox GL JS is not coded as an ES6 module, which means that it doesn't seem to play nicely with SvelteKit. As the library is currently using an ES6-compatible version of the JS file generated by Skypack, although SvelteKit still seems to be experiencing issues.

Ideally, we should find a better way to import the dependency, or to explore the use of MapLibre GL JS as a plug-in replacement.

bothness commented 2 years ago

In finding a solution to this issue, it is more important to prioritise IE11 and SvelteKit compatibility than REPL compatibility.