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

Moved MapLibre to use the Astro directive is:inline #1

Open
roblabs opened this issue Apr 16, 2024 · 0 comments
Open

Moved MapLibre to use the Astro directive is:inline #1

roblabs opened this issue Apr 16, 2024 · 0 comments

Comments

@roblabs
Copy link
Owner

roblabs commented Apr 16, 2024

For the MapLibre Astro Component, we had a pattern like below, but it was causing problems when importing into an Astro Project. The work around is to pull using the Astro directive is:inline.

{/* Astro specific way to pull in MapLibre:  https://docs.astro.build/en/reference/directives-reference/#isinline */}
<script is:inline src="https://unpkg.com/maplibre-gl/dist/maplibre-gl.js"></script>

This was the previous way, but caused issue with named export or other node importing issues.

  import * as maplibregl from 'maplibre-gl'

  var map = new maplibregl.Map({
        container: this.dataset.container,
        interactive: JSON.parse(this.dataset.interactive),
        center: [this.dataset.longitude, this.dataset.latitude],
        zoom: this.dataset.zoom,
        style: this.dataset.mapstyle
  })

In our research, we reviewed or had similar issues as the following MapLibre GL JS issues:

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