vuejs / composition-api

Composition API plugin for Vue 2
https://composition-api.vuejs.org/
MIT License
4.19k stars 343 forks source link

Vue cli 5 compatibility #918

Closed kstraszewski closed 2 years ago

kstraszewski commented 2 years ago

Hi, I have a problem with compatibility with the new Vue CLI 5. After updating project to Vue CLI 5 I've come across weird warnings:

The setup binding property "x" is already declared.

and

onMounted is called when there is no active component instance to be associated with. Lifecycle injection APIs can only be used during execution of setup().

This errors occurs for every component written in Composition API.

HanbgCN commented 2 years ago

I got the same problem, saddly

chenguzhen87 commented 2 years ago

I got the same problem ....

xiaoxiangmoe commented 2 years ago

Can you give me a minimal reproductive repo?

azamat-sharapov commented 2 years ago

I narrowed down the issue. It's happening starting release 1.0.1. I don't know what exactly is causing this, here are changes in that release: https://github.com/vuejs/composition-api/compare/v1.0.0...v1.0.1

EDIT: Actually error that I got was "No vue dependency found". Then I did Vue.use(VueCompositionAPI) at the top of that file, which ended up calling setup() functions in components twice. So, maybe you are doing same thing. Try to console.log() inside setup() function and see if it's called more than once.

github-actions[bot] commented 2 years ago

Stale issue message