0👍
The @nuxtjs/composition-api package backported Composition API functionality to Vue2, however this is no longer require as Nuxt3 is built on top of Vue3; To resolve this issue, you should be able to remove the package from your package.json
and as a dependency, and use the associated Composition API functions (ref, computed, etc) without requiring any imports, as Nuxt is now handling this via auto-imports, which you can read more about with the below link:
https://nuxt.com/docs/guide/concepts/auto-imports
Hope this helps you migrate to Nuxt 3 🙂
- [Vuejs]-How to show date in 13-digit Unix Timestamp format in JSpreadSheet?
- [Vuejs]-[ElectronJS][VueJs] ERR_OSSL_EVP_UNSUPPORTED
0👍
I’m also migrating a Nuxt 2 project to Nuxt 3 with the @nuxtjs/composition-api
package.
One error is that vue 3 deleted the set
and del
functions so in order to migrate to 3 you must replace those with a working solution.
Remove usage of Vue.set()
with a compilant Vue 3 reactivity assing.
Maybe this post can help!
Then replace all usage of @nuxtjs/composition-api
with imports from
import { onMounted, computed, ref } from "@nuxtjs/composition-api"; // <-- REMOVE
import { onMounted, computed, ref } from "vue"; // <-- ADD from vue
import { useRoute } from "@nuxtjs/composition-api"; // <-- REMOVE
import { useRoute } from "#imports"; // <-- ADD Path from Nuxt 3
import { useContext } from "@nuxtjs/composition-api";
import { useNuxtApp } from "#imports"; // <-- ADD Path from Nuxt 3
Vuex
Also as bonus if you still use Vuex to handle stores you could use this package for Nuxt 3, then replace:
import { useStore } from "@nuxtjs/composition-api";
import { useStore } from "vuex";
- [Vuejs]-Upload a Base64 String with GraphQL mutation
- [Vuejs]-How to close menu list by click in to component in vue