Vue HeadlessUI Error: The function vue.defineComponent is not recognized

Trying to incorporate @headlessui/vue into my nuxt project has been a challenge.

My attempt at using it looks like this:

<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
    }
  },
....

This setup leads to a type error during compilation:

TypeError
vue.defineComponent is not a function

Answer №1

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

Is NuxtJS currently using Vue 3 or are they still on Vue 2?

NuxtJS has not yet transitioned to Vue 3, but a beta version is expected in the near future 👍🏻

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

A guide on cycling through keys in an object with changing values using Typescript

Struggling with a beginner question here - I'm having trouble iterating through an object with dynamic keys in Typescript //This is how I've typed my object let obj: { [key: string]: string } = {}; Using forEach or map isn't working and thr ...

Utilize a generic approach for every element within a union: Transforming from Some<1 | 2 | 3> to individual Some<1>, Some<2>, or Some<3> instances

As I was unable to create a concise example for my issue, this is a general rendition of it. I am facing a scenario where the "sequence of application" is vital in nested generics. type Some<A> = {type: A} type Union1 = Some<1 | 2 | 3> type Uni ...

Is it possible to globally define a namespace in Typescript?

Seeking a way to make my Input module accessible globally without the need for explicit path definitions. Currently, I have to import it like this: import { Input } from "./Input/Input";. Is there a method to simplify the import statement for modules con ...

Unlock the Power of Angular with Custom Decorators: Accessing ElementRef Made Easy

I am currently working on implementing a decorator for Host CSS Variable Binding in Angular5. However, I am facing difficulties in properly implementing it with the given code. Is there a way to define ElementRef from within the decorator itself? export f ...

Issue encountered with the @babel/plugin-proposal-private-property-in-object package persists despite successful installation

Every time I try to run my Nuxt app, an error pops up: Error: [BABEL] C:\Users\my.name\Projects\blabla_project\.nuxt\client.js: --- PLACEHOLDER PACKAGE --- The @babel/plugin-proposal-private-property-in-object version being i ...

Enhance autocomplete functionality by incorporating a left icon feature for text fields within the autocomplete component

I have a component with autocomplete functionality that displays tags Autocomplete with tags and I am trying to add a left icon, but only the right icon is functioning correctly. Current Issue When I add a left icon, it shows up but prevents the renderi ...

Error message: ParseError: Received an unexpected character '<' while running tests using AVA

Initially encountering an issue within the project built on nuxt, I attempted to resolve it by creating a new project using vue-cli and re-installing AVA via npm. However, this did not have any effect on the problem at hand. Upon researching, I came across ...

Using Vue.js to create dynamic routes that fetch and utilize a unique parameter ID

user/index.vue <tbody> <tr v-for="item in items" :key="item.id" > <td v-if="false" v-text="item.id" /> <td v-text="item.name" /> ...

Performing actions simultaneously with Angular 2 directives

My custom directive is designed to prevent a double click on the submit button: import { Directive, Component, OnInit, AfterViewInit, OnChanges, SimpleChanges, HostListener, ElementRef, Input, HostBinding } from '@angular/core'; @Directive({ ...

Using *ngFor to populate an array in an ion-list within Ionic 2

Hi there, I'm currently learning Ionic 2 and I recently created an array that I want to loop through in an ion-list. This is my produk.ts import { Component } from '@angular/core'; import { NavController, NavParams } from 'ionic-angul ...

The proper method for updating data on a backend API using Axios and Vue

I am working on a Vue application that includes several form fields. I want to ensure that any changes made by the user are saved in real-time to a backend database using a REST API with Axios, without requiring the user to click a save button. I have two ...

Tips for refreshing a component after fetching a new page using the useQuery function

Attempting to retrieve and display data from my custom API using axios and react-query's useQuery. The API incorporates pagination, and I have implemented a table with an option to select the page that displays the current data. Everything functions c ...

Vuejs - Expanding Panels

Trying to implement an accordion using Vue.js has been a bit challenging for me. While I came across some examples online, my requirements are slightly different. In order to maintain SEO compatibility, I need to use "is" and "inline-template", which make ...

Combining objects using Vue.js and Axios

After fetching data from an axios request and a fetch call to an RSS feed, I have two objects with fields that serve the same purpose but have different names. See the example below: Two Object The objects currently look like this: Obj1 = {title: "Main te ...

What's the best way to implement asynchronous state updating in React and Redux?

In my React incremental-style game, I have a setInterval function set up in App.ts: useEffect(() => { const loop = setInterval(() => { if (runStatus) { setTime(time + 1); } }, rate); return () => clearInterval(lo ...

Tips for utilizing the 'crypto' module within Angular2?

After running the command for module installation: npm install --save crypto I attempted to import it into my component like this: import { createHmac } from "crypto"; However, I encountered the following error: ERROR in -------------- (4,28): Canno ...

Troubleshooting Next.js 14 Project's NextUI Components Integration Problem

Currently, I am working on a project that involves Next.js 14 and integrates NextUI for UI components. Unfortunately, I have run into an issue where the NextUI components are not behaving as expected. To provide more clarity, I have included two images: o ...

Pause for Progress - Angular 6

I'm looking for a solution to solve the following issue. I need to access a property that will store data from an http request. Therefore, I want to verify this property only after the transaction is completed. validateAuthorization(path: string): ...

Issue encountered while attempting to create a dockerized vue/quasar/node application: "Execution of the command '/bin/sh -c quasar build' resulted in a non-zero exit code: 1"

I am having trouble creating a vue/quasar app with the Dockerfile, encountering some errors: Upon running the command '/bin/sh -c quasar build', I received a non-zero code: 1 Currently, I am utilizing the latest LTS node version. Executing the ...

What methods can I use to locate the circular dependency within my program?

I am facing numerous circular dependency errors in my Angular project, causing it to malfunction. Is there a way to identify the section of the code where these circular dependencies exist? Warning: Circular dependency detected: src\app&bs ...