\n\n### Reproduction\n\nhttps://stackblitz.com/edit/vitejs-vite-m1bs1kix?file=src%2FApp.vue\n\n### System Info\n\n```Shell\nSystem:\n OS: Windows 11 10.0.22631\n CPU: (16) x64 AMD Ryzen 7 8845HS w/ Radeon 780M Graphics\n Memory: 12.32 GB / 31.31 GB\nBinaries:\n Node: 22.15.1 - D:\\Program Files\\nodejs\\node.EXE\n npm: 10.9.2 - D:\\Program Files\\nodejs\\npm.CMD\n pnpm: 10.12.2 - D:\\Program Files\\nodejs\\pnpm.CMD\nBrowsers:\n Edge: Chromium (127.0.2651.98)\n Internet Explorer: 11.0.22621.3527\nnpmPackages:\n @vueuse/core: ^13.4.0 => 13.4.0\n vue: v3.6.0-alpha.1 => 3.6.0-alpha.1\n```\n\n### Used Package Manager\n\npnpm\n\n### Validations\n\n- [x] Follow our [Code of Conduct](https://github.com/vueuse/vueuse/blob/main/CODE_OF_CONDUCT.md)\n- [x] Read the [Contributing Guidelines](https://github.com/vueuse/vueuse/blob/main/CONTRIBUTING.md).\n- [x] Read the [docs](https://vueuse.org/guide).\n- [x] Check that there isn't [already an issue](https://github.com/vueuse/vueuse/issues) that reports the same bug to avoid creating a duplicate.\n- [x] Make sure this is a VueUse issue and not a framework-specific issue. For example, if it's a Vue SFC related bug, it should likely be reported to https://github.com/vuejs/core instead.\n- [x] Check that this is a concrete bug. For Q&A open a [GitHub Discussion](https://github.com/vueuse/vueuse/discussions).\n- [x] The provided reproduction is a [minimal reproducible example](https://stackoverflow.com/help/minimal-reproducible-example) of the bug.",[3030],{"name":3031,"color":3032},"pending triage","d73a4a",4875,"BUG | `provideLocal` and `injectLocal` | In Vue's vapor mode, `getCurrentInstance` returns `null`","2025-07-14T06:38:22Z","https://github.com/vueuse/vueuse/issues/4875",0.6804375,{"description":3039,"labels":3040,"number":3044,"owner":3020,"repository":3021,"state":3022,"title":3045,"updated_at":3046,"url":3047,"score":3048},"### Reproduction\r\n\r\nhttps://github.com/bgoscinski/repro-vue-compat-reactivity\r\n\r\n### Steps to reproduce the bug\r\n\r\n1. Run `npm install`\r\n1. Run `npm test`. Test fails\r\n1. Remove `'vue': '@vue/compat'` alias from `./vite.config.js`\r\n1. Run `npm test` again. Test passes 🤯\r\n\r\n### Expected behavior\r\n\r\nReactivity is preserved when using `vue-demi` with `@vue/compat`\r\n\r\n### Actual behavior\r\n\r\nNo/broken reactivity\r\n\r\n### Additional information\r\n\r\nI think that vue-demi doesn't use the reactivity primitives from @vue/compat so we end up with both of these loaded at the same time:\r\n* `node_modules/@vue/compat/dist/vue.cjs.js`\r\n* `node_modules/@vue/reactivity/dist/reactivity.cjs.js`\r\n\r\nBecause of that the component's render effect is not tracking all reactive values properly. \r\n\r\nI'm coming from https://github.com/vuejs/pinia/issues/2565 but it's still not clear for me how to properly configure aliases and I think it would be beneficial for the whole ecosystem to have this documented somewhere.",[3041],{"name":3042,"color":3043},"help wanted","008672",253,"Reactivity loss when using with @vue/compat","2024-02-02T18:38:52Z","https://github.com/vueuse/vue-demi/issues/253",0.72919565,{"description":3050,"labels":3051,"number":3052,"owner":3020,"repository":3021,"state":3053,"title":3054,"updated_at":3055,"url":3056,"score":3057},"For some reason, Vuelidate's `useVuelidate()` function crashes on `vue-demi`'s `getCurrentInstance()`, but only in Codesandbox (with Vue 2 only) and StackBlitz (any version of Vue).\r\n\r\nI initially opened a [Vuelidate issue](https://developer.mozilla.org/en-US/docs/Web/API/HTMLMediaElement/canplaythrough_event), but they [punted to `vue-demi`](https://github.com/vuelidate/vuelidate/issues/877#issuecomment-859998691).\r\n\r\n---\r\n\r\nFollowing the [guide for using Vuelidate with Composition API](https://vuelidate-next.netlify.app/#alternative-syntax-composition-api), I'm seeing an error when `useVuelidate()` is called:\r\n\r\n```\r\nindex.js:27 TypeError: (0 , $csb__vuedemi.getCurrentInstance) is not a function\r\n```\r\n\r\nThis seems to occur only in Codesandbox or StackBlitz. Running the same code in a Vue CLI scaffolded project works fine.\r\n\r\n\u003Cdetails>\r\n\u003Csummary>Stack trace\u003C/summary>\r\n\u003Cpre>\r\nindex.js:27 TypeError: (0 , $csb__vuedemi.getCurrentInstance) is not a function\r\n at useVuelidate (index.esm.js:580)\r\n at setup (App.vue:32)\r\n at mergedSetupFn (vue-composition-api.esm.js:1957)\r\n at eval (vue-composition-api.esm.js:1770)\r\n at activateCurrentInstance (vue-composition-api.esm.js:1708)\r\n at initSetup (vue-composition-api.esm.js:1769)\r\n at VueComponent.wrappedData (vue-composition-api.esm.js:1756)\r\n at getData (vue.common.dev.js:4754)\r\n at initData (vue.common.dev.js:4711)\r\n at initState (vue.common.dev.js:4650)\r\n at VueComponent.Vue._init (vue.common.dev.js:5010)\r\n at new VueComponent (vue.common.dev.js:5157)\r\n at createComponentInstanceForVnode (vue.common.dev.js:3307)\r\n at init (vue.common.dev.js:3136)\r\n at createComponent (vue.common.dev.js:6013)\r\n at createElm (vue.common.dev.js:5960)\r\n at Vue.patch [as __patch__] (vue.common.dev.js:6549)\r\n at Vue._update (vue.common.dev.js:3957)\r\n at Vue.updateComponent (vue.common.dev.js:4078)\r\n at Watcher.get (vue.common.dev.js:4490)\r\n at new Watcher (vue.common.dev.js:4479)\r\n at mountComponent (vue.common.dev.js:4085)\r\n at Vue.$mount (vue.common.dev.js:9084)\r\n at Vue.$mount (vue.common.dev.js:11989)\r\n at evaluate (main.js? [sm]:9)\r\n at V (eval.js:42)\r\n at ee.evaluate (transpiled-module.js:699)\r\n at ge.evaluateTranspiledModule (manager.js:297)\r\n at ge.evaluateModule (manager.js:268)\r\n at compile.ts:728\r\n at c (runtime.js:45)\r\n at Generator._invoke (runtime.js:274)\r\n at Generator.forEach.t.\u003Ccomputed> [as next] (runtime.js:97)\r\n at r (asyncToGenerator.js:3)\r\n at u (asyncToGenerator.js:25)\r\n\u003C/pre>\r\n\u003C/details>\r\n\r\n**Reproduction URL**\r\nhttps://codesandbox.io/s/usevuelidate-bug-getcurrentinstance-is-not-a-function-6rx9w\r\n\r\nor\r\n\r\nhttps://stackblitz.com/edit/vuelidate-bug-demo\r\n\r\n**To Reproduce**\r\nSteps to reproduce the behavior:\r\n1. Create new [Codesandbox for Vue 2](https://vue.new) (or fork [Vuelidate's official Vue 3 + Composition API Starter](https://codesandbox.io/s/vuelidate-2-composition-api-vue-3-7wf99) and switch Vue version to 2.x).\r\n2. Add dependency for `@vue/composition-api`, and install it from `main.js`:\r\n\r\n ```js\r\n import VueCompositionApi from '@vue/composition-api'\r\n Vue.use(VueCompositionApi)\r\n ```\r\n\r\n3. Open `src/App.vue`, and copy [Vuelidate guide's example code for the Composition API usage](https://vuelidate-next.netlify.app/#alternative-syntax-composition-api):\r\n\r\n ```js\r\n import { reactive, toRefs } from '@vue/composition-api'\r\n import useVuelidate from '@vuelidate/core'\r\n import { required, email } from '@vuelidate/validators'\r\n\r\n export default {\r\n setup () {\r\n const state = reactive({\r\n firstName: '',\r\n lastName: '',\r\n contact: {\r\n email: ''\r\n }\r\n })\r\n const rules = {\r\n firstName: { required }, // Matches state.firstName\r\n lastName: { required }, // Matches state.lastName\r\n contact: {\r\n email: { required, email } // Matches state.contact.email\r\n }\r\n }\r\n\r\n const v$ = useVuelidate(rules, state)\r\n\r\n return { ...toRefs(state), v$ }\r\n }\r\n }\r\n ```\r\n\r\n4. See error in browser console\r\n\r\n**Expected behavior**\r\nThe same output from [Vuelidate's official Vue 3 + Composition API Starter](https://codesandbox.io/s/vuelidate-2-composition-api-vue-3-7wf99).\r\n\r\n**Screenshots**\r\n\u003Cimg width=\"469\" alt=\"Screen Shot 2021-06-11 at 10 14 50 PM\" src=\"https://user-images.githubusercontent.com/26580/121763534-7815cd80-cb02-11eb-924e-c4402978d976.png\">\r\n\r\n\r\n**Additional context**\r\n\r\n * `vue` 2.6.14\r\n * `@vue/composition-api` 1.0.0-rc.11\r\n * `@vuelidate/core` 2.0.0-alpha.14 (also newer versions, including 2.0.0-alpha.19)\r\n * `@vuelidate/validators` 2.0.0-alpha.12 (also newer versions, including 2.0.0-alpha.17)\r\n * macOS BigSur\r\n * Chrome 91\r\n * StackBlitz (version unknown, but as of 11-Jun-2021)\r\n * CodeSandbox a566285e0\r\n",[],68,"closed","\"getCurrentInstance is not a function\" in Codesandbox/StackBlitz","2021-07-15T17:21:06Z","https://github.com/vueuse/vue-demi/issues/68",0.6800592,{"description":3059,"labels":3060,"number":3061,"owner":3020,"repository":3021,"state":3053,"title":3062,"updated_at":3063,"url":3064,"score":3065},"\r\n\r\n\r\nWhen using in Vue 2.6, the hasInjectionContext method will be executed. At this point, the default method exposed by VueCompositionAPI is only install. You need to selectively import getCurrentInstance.",[],231,"Vue 2.6: Error \"VueCompositionAPI.getCurrentInstance is not a function\" in hasInjectionContext()","2023-05-18T10:21:16Z","https://github.com/vueuse/vue-demi/issues/231",0.68459356,{"description":3067,"labels":3068,"number":3069,"owner":3020,"repository":3020,"state":3053,"title":3070,"updated_at":3071,"url":3072,"score":3073},"get vue [Global config](https://v3.vuejs.org/api/application-config.html#globalproperties)\r\n\r\nsimple code demo:\r\n\r\n```\r\nimport { getCurrentInstance } from 'vue'\r\nexport function useGlobalConfig(key) {\r\n const vm: any = getCurrentInstance()\r\n if (key in vm.proxy) {\r\n return vm.proxy.key\r\n }\r\n return {}\r\n}\r\n```",[],261,"add useGlobalConfig suggestion","2020-12-22T06:48:04Z","https://github.com/vueuse/vueuse/issues/261",0.69051856,{"description":3075,"labels":3076,"number":3077,"owner":3020,"repository":3020,"state":3053,"title":3078,"updated_at":3079,"url":3080,"score":3081},"I get errors like\r\n\r\n```\r\nERROR in node_modules/@vueuse/core/index.d.ts(1,21):\r\n1:21 Cannot find module '@vue/composition-api/dist/reactivity/ref' or its corresponding type declarations.\r\n > 1 | import { Ref } from '@vue/composition-api/dist/reactivity/ref';\r\n```\r\n\r\nSame code works with composition-api v0.6.1",[],88,"Types seems to be broken with composition-api v0.6.3","2020-06-16T00:50:03Z","https://github.com/vueuse/vueuse/issues/88",0.69437915,{"description":3083,"labels":3084,"number":19,"owner":3020,"repository":3021,"state":3053,"title":3085,"updated_at":3086,"url":3087,"score":3088},"## Summary\r\n\r\nI tried using `vue-demi-switch 2 vue2` and defining `\"vue2\": \"npm:vue@2\"` in my package.json, but when I run tests, the `@vue/composition-api` breaks, because it imports Vue as `var Vue = require('vue');`\r\n\r\nDo you have any advice on how to proceed with this? I saw `vueuse/core` uses this approach but I couldnt see if you have a fix for this.\r\n\r\nYou can see this in https://github.com/vuelidate/vuelidate/tree/next",[],"Switching between Vue 2 and Vue 3 to run tests with Composition API","2022-07-06T17:23:19Z","https://github.com/vueuse/vue-demi/issues/38",0.6995052,{"description":3090,"labels":3091,"number":3092,"owner":3020,"repository":3020,"state":3053,"title":3093,"updated_at":3094,"url":3095,"score":3096},"Upgrading from @vueuse/core ^4.11.0 -> @vueuse/core ^7.3.0 results in the title error\r\n\r\n\r\n\r\n\r\nRunning \r\n`npx vue-demi-fix` or `npx vue-demi-switch 2`\r\nDoes not fix the issue.\r\n\r\nApplication is running\u003Cbr/>\r\n`\"vue\":\"^2.6.14\"`\r\n`\"@vue/composition-api\":\"^1.4.1\"`\r\n\r\nCan anyone advise?\r\n\r\nMy only resolution atm is to downgrade and duplicate vueUse functionality intending for use.\r\n",[],1070,"Vue2 + Vue composition-api: Error in data(): \"TypeError: vueDemi.getCurrentScope is not a function\"","2022-09-21T19:28:08Z","https://github.com/vueuse/vueuse/issues/1070",0.70483404,{"description":3098,"labels":3099,"number":3100,"owner":3020,"repository":3021,"state":3053,"title":3101,"updated_at":3102,"url":3103,"score":3104},"Hello @antfu ,\r\n\r\nI am currently working on a SPA using `vue2` + `options-api` . This SPA imports another component library (`vue2` + `@vue/composition-api`), which simply exposes a single vue component. The component library also uses `@vueuse/core` using `vue-demi`.\r\n\r\nHere's an example of the exported component of the library (can not share everything since it's an company internal project)\r\n```vue\r\n\u003Ctemplate>\r\n \u003Cdiv>\r\n \u003Cp>FOO: {{ blub }}\u003C/p> \u003C!-- will stay false -->\r\n \u003Cbutton @click.stop=\"click\">CLICK ME\u003C/button>\r\n \u003C/div>\r\n\u003C/template>\r\n\r\n\u003Cscript>\r\nimport { defineComponent, ref } from \"@vue/composition-api\"\r\nimport { useLocalStorage } from \"@vueuse/core\"\r\n\r\nexport default defineComponent({\r\n setup: (props) => {\r\n const foo = ref(false)\r\n\r\n const storageLocale = useLocalStorage(\"some_key\", \"en-GB\", {\r\n listenToStorageChanges: true,\r\n window,\r\n })\r\n\r\n return {\r\n foo,\r\n click: () => {\r\n console.log(\"before click\", foo.value)\r\n foo.value = true\r\n console.log(\"after click\", foo.value) // \u003C-- will be true\r\n },\r\n }\r\n },\r\n})\r\n\u003C/script>\r\n```\r\n\r\nSo basically everything works pretty good. But as soon as I add the `useLocalStorage` or any other composable from `@vueuse/core`, the template will not re-render as soon as the button was clicked. The ref value itself works, only the template does not update. I did a lot of debugging together with my colleague, and we figured out that the template will update, as soon as we get rid of all `vue-demi` based code.\r\n\r\nDependencies of the SPA:\r\n```json\r\n\"dependencies\": {\r\n \"vue\": \"^2.6.10\",\r\n \"@company/components\": \"1.0.0\",\r\n \"@vue/composition-api\": \"1.0.0-beta.25\"\r\n},\r\n\"devDependencies\": {\r\n ... all other\r\n}\r\n``` \r\nDependencies of the ComponentLibrary: \r\n```json\r\n\"dependencies\": {\r\n \"@vueuse/core\": \"4.0.10\"\r\n},\r\n\"devDependencies\": {\r\n \"vue\": \"^2.6.10\",\r\n \"@vue/composition-api\": \"1.0.0-beta.25\"\r\n ... all other\r\n}\r\n```\r\n\r\nDo you know what could be the issue here?\r\n\r\nKind regards,\r\nLukas",[],35,"vue-demi breaks composition-api template re-rendering (vue2)","2021-02-06T14:34:10Z","https://github.com/vueuse/vue-demi/issues/35",0.7067125,["Reactive",3106],{},["Set"],["ShallowReactive",3109],{"$fTRc1wZytZ_XrK4EfJfei_Sz-An4H4Yy6syhVxH_PVJc":-1,"$fmiqG7lltiV_UYAd8rFj8WRtYQnFNTfVSUir0-t5HSuw":-1},"/vueuse/vue-demi/23"]