Skip to content

Vue 2.7: Error "VueCompositionAPI is not defined" in hasInjectionContext() #224

New issue

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

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

Already on GitHub? # to your account

Closed
tkallage opened this issue May 17, 2023 · 3 comments · Fixed by #225
Closed

Vue 2.7: Error "VueCompositionAPI is not defined" in hasInjectionContext() #224

tkallage opened this issue May 17, 2023 · 3 comments · Fixed by #225

Comments

@tkallage
Copy link

tkallage commented May 17, 2023

I am using Vue 2.7.14

Since upgrading pinia from 2.0.36 to 2.1.0, I get the following error, originating from vue-demi:
grafik
grafik
grafik
Pinia 2.0 does not produce this issue, as it used hasInjectionContext from the vue package instead of vue-demi (see vuejs/pinia@915e754)

JSFiddle with Pinia 2.0 (working):
https://jsfiddle.net/mk56hoqe/2/
JSFiddle with Pinia 2.1 (broken):
https://jsfiddle.net/egay83mp/4/

@daniluk4000
Copy link

@antfu :(

image

@tkallage
Copy link
Author

well.. my jsfiddle minimal repro works now - but in my project the errors is still there.

In my project the .cjs is used in my jest tests and .mjs is used by vue-cli. In both cases the error "VueCompositionAPI is not defined" still exists.

I actually dont know how to provide a minimal example with jsfiddle in this case...

@tkallage
Copy link
Author

I reopened this issue with updated example code:
#228

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants