@unmap/nuxt
@unmap/nuxt
Nuxt 3 module for unmap. Publishes unmap: { key, gateway } to public
runtime config and auto-imports the @unmap/vue composables (useUnmap, useGeocoder,
useDirections) into every component.
npm i @unmap/nuxt
// nuxt.config.ts
export default defineNuxtConfig({
modules: ['@unmap/nuxt'],
unmap: { key: 'um_live_...' },
css: ['maplibre-gl/dist/maplibre-gl.css'],
})
The key can also come from the environment as NUXT_PUBLIC_UNMAP_KEY, and the gateway as
NUXT_PUBLIC_UNMAP_GATEWAY. Then, in any component:
<script setup lang="ts">
const { mapContainer } = useUnmap({ key: useRuntimeConfig().public.unmap.key, center: [-73.57, 45.5] })
</script>
<template>
<div ref="mapContainer" style="height: 400px" />
</template>
Add MapLibre's stylesheet once, for controls, attribution, markers, and popups:
// nuxt.config.ts
export default defineNuxtConfig({
modules: ['@unmap/nuxt'],
unmap: { key: 'um_live_...' },
css: ['maplibre-gl/dist/maplibre-gl.css'],
})
maplibre-gl arrives as a transitive dependency; under pnpm's strict layout add it as a direct
dependency so the import resolves.
Requires Nuxt 3.13 or later. Docs: unmap.dev/docs.
Related Packages
Version History
| Version | Released | License |
|---|---|---|
| 0.21.0 | MIT | |
| 0.20.0 | MIT | |
| 0.19.0 | MIT | |
| 0.18.0 | MIT | |
| 0.17.0 | MIT | |
| 0.16.0 | MIT | |
| 0.15.0 | MIT | |
| 0.14.0 | MIT | |
| 0.13.0 | MIT | |
| 0.12.0 | MIT | |
| 0.10.0 | MIT | |
| 0.9.1 | MIT | |
| 0.9.0 | MIT | |
| 0.8.0 | MIT | |
| 0.7.0 | MIT | |
| 0.6.0 | MIT | |
| 0.5.0 | MIT | |
| 0.3.0 | MIT | |
| 0.2.0 | MIT | |
| 0.1.3 | MIT | |
| 0.1.2 | ||
| 0.1.1 | ||
| 0.0.5 | ||
| 0.0.3 | ||
| 0.0.2 | ||
| 0.0.1 |