4

I try to install @headlessui/vue in my nuxt project.

When I try to use it like:

<template>
  <Menu>
    <MenuItems>
      <MenuItem>Item</MenuItem>
    </MenuItems>
  </Menu>
</template>

<script lang="ts">
import Vue from 'vue'
import { Menu, MenuButton, MenuItems, MenuItem } from '@headlessui/vue'

export default Vue.extend({
  components: { Menu, MenuButton, MenuItems, MenuItem },
  data () {
    return {
      isScrolling: false
    }
  },
....

I get a type error while compiling

TypeError
vue.defineComponent is not a function
1

1 Answer 1

10

Exactly the same question here: https://github.com/tailwindlabs/headlessui/issues/31

This library is created for Vue 3. I am not sure that NuxtJS is using Vue 3, I think they are using Vue 2. Can you verify this?

Yep Nuxt hasn’t released a version on Vue 3 yet but as far as I understand a beta is coming in the near future 👍🏻

2
  • Hi, this has been around for a while, but I'm still getting this error with Nuxt. Is there a way to fix? I'm using chartjs vue wrapper with Nuxt and getting this error Apr 18, 2022 at 14:24
  • @CornelVerster this is unrelated to HeadlessUI. I've answered you on your own question.
    – kissu
    Apr 18, 2022 at 16:17

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.