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: Could not resolve Map in Nuxt 3 #1135

Open
timgoeller opened this issue Aug 4, 2022 · 0 comments
Open

Error: Could not resolve Map in Nuxt 3 #1135

timgoeller opened this issue Aug 4, 2022 · 0 comments

Comments

@timgoeller
Copy link

timgoeller commented Aug 4, 2022

For some reason, the provide/inject of the Map seems to be broken in Nuxt 3. It might be, because provide is called in a onMounted-hook. This causes (for example) a VControlFullscreen inserted into the VMap to produce the Error: Could not resolve Map error message when trying to inject the Map.

A temporary fix for me is to put a ref on the VMap and load the components once the ref is initialized, like so:

<template>
  <VMap
    ref="vmap"
  >
    <VControlFullscreen if="mounted"></VControlFullscreen>
  </VMap>
</template>

<script setup>
import { VMap, VControlFullscreen } from 'v-mapbox';

const vmap = ref(null)
const mounted = ref(false)

watch(vmap, () => {
  mounted.value = true
})
</script>
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