Does anyone know how to install @nuxtjs/composition-api in nuxt3?
P粉195200437
P粉195200437 2023-07-28 12:23:55
0
1
404
<p>I had a Nuxt 2 project before, in which the version of the "@nuxtjs/composition-api" package installed was "^0.33.1". Now I need to change Nuxt version from 2.5 to 3.6.2. If you can help me solve this problem, I will be very grateful. </p><p>I have made the changes but am currently getting an error when running the yarn dev command. </p><p><br /></p> <pre class="brush:php;toolbar:false;">ERROR error while updating dependencies: 4:36:09 PM Error: Build failed with 3 errors: node_modules/@nuxtjs/composition-api/dist/runtime/index.mjs:1:175: ERROR: No matching export in "node_modules/vue/dist/vue.runtime.esm-bundler.js" for import "set" node_modules/@nuxtjs/composition-api/dist/runtime/index.mjs:2:30: ERROR: No matching export in "node_modules/vue/dist/vue.runtime.esm-bundler.js" for import "del" node_modules/@nuxtjs/composition-api/dist/runtime/index.mjs:2:409: ERROR: No matching export in "node_modules/vue/dist/vue.runtime.esm-bundler.js" for import "set" at failureErrorWithLog (C:UsersskyWebtestfrontendnode_modulesvitenode_modulesesbuildlibmain.js:1636:15) at C:UsersskyWebtestfrontendnode_modulesvitenode_modulesesbuildlibmain.js:1048:25 at C:UsersskyWebtestfrontendnode_modulesvitenode_modulesesbuildlibmain.js:1512:9 at process.processTicksAndRejections (node:internal/process/task_queues:95:5)</pre> <p>Where can I find the documentation (((, if I remove this package, I get an error when importing import {onMounted, computed, useRoute, useContext, ref} from "@nuxtjs/composition-api" .</p>
P粉195200437
P粉195200437

reply all(1)
P粉194919082

@nuxtjs/composition-api package brings Composition API functionality back to Vue2, however this is no longer needed because Nuxt3 is built on Vue3. To resolve this issue, you should remove the package from package.json and dependencies, and can directly use the relevant Composition API functions (ref, computed, etc.) without any imports, as Nuxt now handles this via automatic imports. You can learn more at the following link:

https://nuxt.com/docs/guide/concepts/auto-imports

Hope this helps you migrate to Nuxt 3 :)


Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!