vueuse / vue-demi

🎩 Creates Universal Library for Vue 2 & 3
MIT License
2.98k stars 155 forks source link

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

Closed tkallage closed 1 year ago

tkallage commented 1 year ago

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 https://github.com/vuejs/pinia/commit/915e754d3669f2d532bcb92ece9e4ea7dcd23240)

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

daniluk4000 commented 1 year ago

@antfu :(

image

tkallage commented 1 year ago

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 commented 1 year ago

I reopened this issue with updated example code: https://github.com/vueuse/vue-demi/issues/228