-1

Is there a way to check is Nuxt.js is being used?

Why I need to do it

For the UI frameworks development, herewith it's unknown will be used with Nuxt.js or just pure Vue. For example, depending on Vue or Nuxt, we need different link component:

<component is="isNuxt ? 'nuxt-link' : 'router-link'" />

What it the implementation of isNuxt method?

1
  • 3
    I don't know if there's any specific variable/function you call call to check that, but since nuxt is built on top of vue, you could just use the basic vue components like router-link, it will work just fine. If you really need to check for more complex components, you could try check for things like useNuxtApp or some specific hook, if it doesn't exists then it's just vue Commented Jul 13, 2022 at 7:16

1 Answer 1

2

I think the easy way could be:

const isNuxt = () => !!window.$nuxt
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.