[Vuejs]-Detect in Vue Component if it's used in Nuxt 3 or somewhere else

0👍

pi0 from the Nuxt community answered my feature request on GitHubhttps://github.com/nuxt/nuxt/issues/19698#issuecomment-1469823282

You can directly use tiny unctx library in your integrations and this
way detect existence of nuxt context:

import { useContext } from 'unctx'

const isNuxt = () => !!useContext('nuxt-app')

I’ve tested it and it works for me.

Leave a comment