Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Version 1.2.0 and 1.2.1 give runtime error at startup #815

Closed
GeekyMonkey opened this issue Sep 22, 2021 · 10 comments
Closed

Version 1.2.0 and 1.2.1 give runtime error at startup #815

GeekyMonkey opened this issue Sep 22, 2021 · 10 comments
Labels
needs reproduction We need a runnable reproduction from the OP

Comments

@GeekyMonkey
Copy link

Version 1.1.5 is fine. But updating to either 1.2.0 or 1.2.1 results in the errors below at startup despite having this loaded in Main.ts. The console log message is displayed before the errors are displayed.

import VueCompositionAPI from "@vue/composition-api";
import Vue from "vue";

console.log("Composition API init");
Vue.use(VueCompositionAPI);

Startup errors:

vue.runtime.esm.js:619 [Vue warn]: Error in mounted hook (Promise/async): "Error: [vue-composition-api] must call Vue.use(VueCompositionAPI) before using any function."

found in

---> <App> at src/App.vue
       <Root>
warn @ vue.runtime.esm.js:619
logError @ vue.runtime.esm.js:1893
globalHandleError @ vue.runtime.esm.js:1888
handleError @ vue.runtime.esm.js:1848
(anonymous) @ vue.runtime.esm.js:1865
Promise.catch (async)
invokeWithErrorHandling @ vue.runtime.esm.js:1865
callHook @ vue.runtime.esm.js:4235
insert @ vue.runtime.esm.js:3158
invokeInsertHook @ vue.runtime.esm.js:6390
patch @ vue.runtime.esm.js:6609
Vue._update @ vue.runtime.esm.js:3960
updateComponent @ vue.runtime.esm.js:4081
get @ vue.runtime.esm.js:4495
Watcher @ vue.runtime.esm.js:4484
mountComponent @ vue.runtime.esm.js:4088
push../node_modules/vue/dist/vue.runtime.esm.js.Vue.$mount @ vue.runtime.esm.js:8459
./src/main.ts @ main.ts:35
__webpack_require__ @ bootstrap:858
fn @ bootstrap:150
1 @ Logout.vue?4cf0:1
__webpack_require__ @ bootstrap:858
checkDeferredModules @ bootstrap:45
(anonymous) @ bootstrap:1039
(anonymous) @ bootstrap:1039
vue.runtime.esm.js:1897 Error: [vue-composition-api] must call Vue.use(VueCompositionAPI) before using any function.
    at assert (vue-composition-api.esm.js:34)
    at getVueConstructor (vue-composition-api.esm.js:315)
    at getWatcherVM (vue-composition-api.esm.js:1132)
    at watch (vue-composition-api.esm.js:1397)
    at index.esm.js:779
    at new Promise (<anonymous>)
    at toMatch (index.esm.js:778)
    at Object.toBeTruthy (index.esm.js:802)
    at App.ts:254
@antfu
Copy link
Member

antfu commented Sep 22, 2021

Can you share a minimal reproduction? Thanks.

@antfu antfu added the needs reproduction We need a runnable reproduction from the OP label Sep 22, 2021
@dragomirweb
Copy link

I get the exact same error running :
@vue/composition-api": "1.2.1
vue": "^2.6.10"

@dragomirweb
Copy link

reproduction: updated from 1.0.5 to 1.2.1 no compilation error app throws [vue-composition-api] must call Vue.use(VueCompositionAPI) before using any function.

@Shinigami92
Copy link

Shinigami92 commented Sep 22, 2021

I'm also affected by this

image

@Ttou
Copy link

Ttou commented Sep 23, 2021

got same error

微信截图_20210923100421

@antfu
Copy link
Member

antfu commented Sep 23, 2021

Can't really help without reproduction

@Ttou
Copy link

Ttou commented Sep 23, 2021

@antfu maybe @vueuse/core cause this error

微信截图_20210923140311

@mokone91
Copy link

mokone91 commented Sep 23, 2021

Same issue but with different message
image
v1.1.5 works fine

a bit more info:
we have application (vue2 + @vue/compositon-api) and 2 libs with different build process
first use vue2 + vue-demi and it works
second use vue2 + @vue/compositon-api which externalised by webpack5 'externals' and it doesn't work

for now issue fixed by downgrading @vue/compositon-api on app side to 1.1.5

@antfu antfu closed this as completed in 96899ce Sep 24, 2021
@RPainter8West
Copy link

Back in business! Thanks!

@Shinigami92
Copy link

Yes, everything working again 🙂 thx

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs reproduction We need a runnable reproduction from the OP
Projects
None yet
Development

No branches or pull requests

7 participants