\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.",[3018],{"name":3019,"color":3020},"pending triage","d73a4a",4875,"vueuse","open","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.73472244,{"description":3029,"labels":3030,"number":3031,"owner":3022,"repository":3032,"state":3023,"title":3033,"updated_at":3034,"url":3035,"score":3036},"I have developed my library using Vue 2.7 and vue-demi with Vite. I am able to consume the library in Vue 2.7 and everything is working fine but not in Vue 3.\r\n\r\nAs soon as I use any of the components from my library, I get below errors in browser console and my components are not instantiated/mounted.\r\n\r\n\r\n\r\nIt seems Vue 3 does not work well with Vue 2. But then what is the point of using vue-demi?\r\n\r\nThe workaround that I have been trying is to publish two separate packages for each version with below scripts:\r\n\r\n```\r\n\"scripts\": {\r\n \"dev\": \"vite\",\r\n \"build:2\": \"vue-demi-switch 2 vue2 && run-p build-only build:styles\",\r\n \"build:3\": \"vue-demi-switch 3 && run-p build-only build:styles\",\r\n.......\r\n}\r\n```\r\n\r\nNow when I try to build for Vue 2, it throws below error:\r\n\r\n```\r\n[vite:vue2] source.startsWith is not a function\r\nfile: /Users/amitchaudhary/Desktop/D/Projects/Mindvalley/mv_universal_player/mv-universal-player/src/components/audio/AudioPlayer/AudioPlayer.vue\r\nerror during build:\r\nTypeError: source.startsWith is not a function\r\n at startsWith (/Users/amitchaudhary/Desktop/D/Projects/Mindvalley/mv_universal_player/mv-universal-player/node_modules/@vue/compiler-core/dist/compiler-core.cjs.prod.js:1420:17)\r\n at isEnd (/Users/amitchaudhary/Desktop/D/Projects/Mindvalley/mv_universal_player/mv-universal-player/node_modules/@vue/compiler-core/dist/compiler-core.cjs.prod.js:1457:11)\r\n at parseChildren (/Users/amitchaudhary/Desktop/D/Projects/Mindvalley/mv_universal_player/mv-universal-player/node_modules/@vue/compiler-core/dist/compiler-core.cjs.prod.js:795:11)\r\n at Object.baseParse (/Users/amitchaudhary/Desktop/D/Projects/Mindvalley/mv_universal_player/mv-universal-player/node_modules/@vue/compiler-core/dist/compiler-core.cjs.prod.js:769:5)\r\n at Object.parse (/Users/amitchaudhary/Desktop/D/Projects/Mindvalley/mv_universal_player/mv-universal-player/node_modules/@vue/compiler-dom/dist/compiler-dom.cjs.prod.js:2956:23)\r\n at Object.parse$2 [as parse] (/Users/amitchaudhary/Desktop/D/Projects/Mindvalley/mv_universal_player/mv-universal-player/node_modules/@vue/compiler-sfc/dist/compiler-sfc.cjs.js:1198:24)\r\n at createDescriptor (file:///Users/amitchaudhary/Desktop/D/Projects/Mindvalley/mv_universal_player/mv-universal-player/node_modules/@vitejs/plugin-vue2/dist/index.mjs:68:27)\r\n at transformMain (file:///Users/amitchaudhary/Desktop/D/Projects/Mindvalley/mv_universal_player/mv-universal-player/node_modules/@vitejs/plugin-vue2/dist/index.mjs:755:34)\r\n at Object.transform (file:///Users/amitchaudhary/Desktop/D/Projects/Mindvalley/mv_universal_player/mv-universal-player/node_modules/@vitejs/plugin-vue2/dist/index.mjs:1104:16)\r\n at file:///Users/amitchaudhary/Desktop/D/Projects/Mindvalley/mv_universal_player/mv-universal-player/node_modules/rollup/dist/es/shared/node-entry.js:24656:40\r\n\r\n```\r\n\r\nPlease let me know what I should do.\r\n\r\n\r\n\r\n\r\n\r\n",[],237,"vue-demi","Can't use Vue 2 library in Vue 3","2023-07-27T00:50:29Z","https://github.com/vueuse/vue-demi/issues/237",0.7418504,{"description":3038,"labels":3039,"number":3040,"owner":3022,"repository":3032,"state":3023,"title":3041,"updated_at":3042,"url":3043,"score":3044},"First of all, I saw a couple of issues that involved more or less the same issue, but I tought it would be useful to group everything into one issue, so we could hopefully try to solve it.\r\n\r\n### Related issues:\r\n\r\n- #145 \r\n- #136 \r\n- #117 \r\n- #129 \r\n\r\n### Problem\r\n\r\nI'm currently building a private reusable package for a real-world application. This application runs on `nuxt2` (currently `nuxt-bridge`), and we're planning to migrate to `nuxt3` when all the packages we need are there. The idea was to build that reusable package in `vue3`, and use `vue-demi` to make it possible to be used in our `nuxt-bridge` app.\r\n\r\nAt first I just tried building the library and use it in a separate vue 3 app. With Vite it was really fast & easy to make it work 🎉\r\n\r\nHowever when I tried importing it in our `nuxt-bridge` app I came across several issues:\r\n\r\n1) When externalising `vue` dependency in vite, I got a list of warnings that some functions are not exported by vue. This is what the most issues are about.\r\n\r\n2) When I don't externalise `vue` in `vite.config.js`, I just get an empty component. In my repro I don't get any warning. I just see an anonymous component in my dev tools. In my production nuxt-app, I see the following error: `no template or render function is defined`. The component seemed to be imported correctly, it just doesn't render any HTML.\r\n\r\n3) I saw in other issues that the solution might be to externalise `vue-demi` as well, but that doesn't seem to make any difference for this.\r\n\r\n4) also tried using `npx vue-demi-fix` && `npx vue-demi-switch 2` commands, but these also doesn't seem to be changing a whole lot.\r\n\r\nI also saw that in #117 , [@koooge](https://github.com/koooge) researched into the issue a bit and saw that it might be due to a breaking change in @vue/core.\r\n\r\nThat's when I decided to build a repro with a vue2 app (@vue/cli), vue3 app (vite) and a simple component in a separate lib.\r\n\r\n### Repro\r\n\r\nhttps://github.com/jclaessens97/vue-demi-vue2-broken-repro\r\n\r\n\r\nI hope we can look into this issue and try to come up with a solution to be able to make vue3 components compatible for vue2, until everything is vue3 ready.\r\n",[],152,"Vue3 lib not working in Vue2 projects","2022-10-14T07:02:51Z","https://github.com/vueuse/vue-demi/issues/152",0.7487131,{"description":3046,"labels":3047,"number":3048,"owner":3022,"repository":3032,"state":3023,"title":3049,"updated_at":3050,"url":3051,"score":3052},"### First off \r\nThanks for all the amazing work! Super excited to be using Vue Demi. 🚀 \r\n\r\n----------------------------------\r\n\r\n### The Problem: \r\nThis is likely a user error, but I'm not able to find any examples of consuming a vue-demi plugin in a Nuxt 2 application to help point me in the right direction. \r\n\r\n**Here's what I have for my package.json in my vue-demi plugin:** \r\n```json\r\n \"peerDependencies\": {\r\n \"@vue/composition-api\": \"^1.4.5\",\r\n \"vue\": \"^2.0.0 || >=3.0.0\"\r\n },\r\n \"peerDependenciesMeta\": {\r\n \"@vue/composition-api\": {\r\n \"optional\": true\r\n }\r\n },\r\n \"dependencies\": {\r\n \"vue-demi\": \"^0.12.5\",\r\n },\r\n```\r\n\r\n```js\r\nmodule.exports = {\r\n chainWebpack: (config) => {\r\n config.externals(['@vue/composition-api', 'vue']);\r\n },\r\n};\r\n```\r\n--------------------------------\r\n\r\n**And in my consuming application:** \r\n```json\r\n\"dependencies\": {\r\n \"my-vue-demi-plugin\": \"1.0.0\",\r\n \"nuxt\": \"^2.15.2\",\r\n}\r\n```\r\n\r\n--------------------------------\r\n\r\nI'm getting the following error: \r\n\u003Cimg width=\"497\" alt=\"Screen Shot 2022-04-25 at 7 18 40 PM\" src=\"https://user-images.githubusercontent.com/2212763/165194784-1eb33040-08e7-467c-984f-ed369a03a61c.png\">\r\n\r\n--------------------------------\r\n\r\nUpon further inspection, I see that there's a `default` nested inside of external vue reference, which it seems that the install function isn't expecting. \r\n\r\n\u003Cimg width=\"862\" alt=\"Screen Shot 2022-04-25 at 7 11 52 PM\" src=\"https://user-images.githubusercontent.com/2212763/165194971-acef8f9e-5477-4207-8b5d-a71b60c2a502.png\">\r\n\u003Cimg width=\"966\" alt=\"Screen Shot 2022-04-25 at 7 20 01 PM\" src=\"https://user-images.githubusercontent.com/2212763/165194974-f535ed70-3560-412c-a2e8-8ac25b77b9da.png\">\r\n\r\n\r\nWhat am I missing here? 🤷 🤔 \r\n\r\n",[],155,"Nuxt 2 having issues with the lib_install function ","2022-04-27T14:10:36Z","https://github.com/vueuse/vue-demi/issues/155",0.7541816,{"description":3054,"labels":3055,"number":3056,"owner":3022,"repository":3032,"state":3057,"title":3058,"updated_at":3059,"url":3060,"score":3061},"When I debug the plug-in locally(use: npm link)\r\n\r\n`import { isVue2, isVue3 } from \"vue-demi\";`\r\n\r\n`console.log(isVue2, isVue3) // false true`\r\n\r\nWhen I publish\r\n\r\n`import { isVue2, isVue3 } from \"vue-demi\";`\r\n\r\n`console.log(isVue2, isVue3) // true false `\r\n\r\n\r\nthey are all in vue2 project",[],218,"closed","\"isVue2 isVue3\" there are differences in different environments","2023-03-06T05:59:57Z","https://github.com/vueuse/vue-demi/issues/218",0.68409246,{"description":3063,"labels":3064,"number":1573,"owner":3022,"repository":3032,"state":3057,"title":3065,"updated_at":3066,"url":3067,"score":3068},"Hello, I'm struggling to update from 0.4 to 0.5 because I'm only using Vue 3 at https://github.com/posva/vue-use-spring and I get this TS error:\r\n\r\n```\r\nnode_modules/vue-demi/lib/index.d.ts:4:31 - error TS2709: Cannot use namespace 'Vue' as a type.\r\n\r\n4 declare const install: (vue?: Vue) => void\r\n ~~~\r\n\r\n\r\nFound 1 error.\r\n```\r\n\r\nI tried adding both vue2 and vue 3 like this: https://github.com/antfu/vueuse/blob/master/package.json but inversing them since I'm using Vue 3 inside of the project but it gave me even more errors 😓 \r\n\r\nDo you have any idea of what I'm missing?",[],"How to use if only Vue 3 is locally installed","2021-01-06T12:17:00Z","https://github.com/vueuse/vue-demi/issues/27",0.705494,{"description":3070,"labels":3071,"number":3072,"owner":3022,"repository":3022,"state":3057,"title":3073,"updated_at":3074,"url":3075,"score":3076},"Because some functions are imported from `vue` instead of `vue/demi`, latest release is broken with vue 2.\r\n\r\nhttps://github.com/vueuse/vueuse/compare/v6.2.1...v6.3.1 \r\n\r\nhttps://github.com/vueuse/vueuse/blob/d0fa468799fd9637dac86d9c695ccff2d220d9e7/packages/core/useDraggable/index.ts#L1",[],729,"v6.3.x is broken with vue2","2021-09-08T19:53:21Z","https://github.com/vueuse/vueuse/issues/729",0.7233387,{"description":3078,"labels":3079,"number":3080,"owner":3022,"repository":3032,"state":3057,"title":3081,"updated_at":3082,"url":3083,"score":3084},"Hi. In the README.md, there is a section that says if postinstall is missed, you can run `npx vue-demi-fix` \r\n\r\nbut I can't, and it fails:\r\n\r\n",[],246,"vue-demi-fix is missing","2023-09-29T07:20:27Z","https://github.com/vueuse/vue-demi/issues/246",0.7362477,{"description":3086,"labels":3087,"number":3088,"owner":3022,"repository":3032,"state":3057,"title":3089,"updated_at":3090,"url":3091,"score":3092},"Hi! \r\nim working on components lib and truing to make it vue2/3 compatible using this solution.\r\nBut i faced with issue with vue3 installation.. in vue2 env everything working fine!\r\n Here is my build webpack config: \r\n```\r\nimport merge from 'webpack-merge';\r\nimport { Configuration } from 'webpack';\r\nimport { CleanWebpackPlugin } from 'clean-webpack-plugin';\r\nimport common from './webpack.base.config';\r\nconst { watch } = require('minimist')(process.argv.slice(2));\r\n\r\nconst path = require('path');\r\n\r\n\r\nexport default merge\u003CConfiguration>(common, {\r\n entry: {\r\n main: './src/index.ts',\r\n },\r\n output: {\r\n filename: 'index.js',\r\n path: path.resolve(__dirname, 'dist'),\r\n library: {\r\n name: 'TestLib',\r\n type: 'umd',\r\n },\r\n },\r\n devtool: 'source-map',\r\n mode: watch ? 'development' : 'production',\r\n bail: watch ? false : true,\r\n plugins: [\r\n new CleanWebpackPlugin(),\r\n ],\r\n externals: {\r\n vue: 'vue',\r\n 'vue-demi': 'vue-demi',\r\n 'lodash': 'lodash',\r\n },\r\n});\r\n```\r\non client side im using default vue-cli-service serve^ without additional settings\r\nbut in vue3 environment i got:\r\n\r\n\r\nseems problem somewhere near webpack build config, maybe somebody can share some webpack config examples? \r\nThanks! \r\n\r\n",[],81,"Any webpack example? ","2021-07-28T11:23:14Z","https://github.com/vueuse/vue-demi/issues/81",0.73701394,{"description":3094,"labels":3095,"number":3096,"owner":3022,"repository":3032,"state":3057,"title":3097,"updated_at":3098,"url":3099,"score":3100},"demo: \r\n[https://github.com/jackson-yyy/vue-demi-bug-demo](url)\r\n\r\n## reproduce steps\r\n\r\n1. run `pnpm install`\r\n2. check `node_modules/lib/v3/index.cjs`, it is correct.\r\n```javascript\r\nvar Vue = require('vue')\r\n\r\nObject.keys(Vue).forEach(function(key) {\r\n exports[key] = Vue[key]\r\n})\r\n```\r\n3. run `pnpm switch:vue2`\r\n4. check `node_modules/lib/v3/index.cjs`, it becomes the source code of v2. it shouldn't be changed.\r\n```javascript\r\nvar Vue = require('vue')\r\nvar VueCompositionAPI = require('@vue/composition-api')\r\n```\r\n\r\ni think it's the problem of pnpm. It use symbol link to link file.\r\n\r\ni try to delete files under lib before writing file\r\n\r\n```diff\r\nfunction copy(name, version, vue) {\r\n vue = vue || 'vue'\r\n const src = path.join(dir, `v${version}`, name)\r\n const dest = path.join(dir, name)\r\n let content = fs.readFileSync(src, 'utf-8')\r\n content = content.replace(/'vue'/g, `'${vue}'`)\r\n+ fs.unlinkSync(dest)\r\n fs.writeFileSync(dest, content, 'utf-8')\r\n}\r\n```\r\n\r\nit works perfectly now.",[],92,"bug of switching vue version with pnpm","2021-08-14T07:46:54Z","https://github.com/vueuse/vue-demi/issues/92",0.73956215,["Reactive",3102],{},["Set"],["ShallowReactive",3105],{"$fTRc1wZytZ_XrK4EfJfei_Sz-An4H4Yy6syhVxH_PVJc":-1,"$fdIV6AOQrPuYMEJ9gEpXFsbUU1sJGGZrksxz91Nftnr0":-1},"/vueuse/vue-demi/134"]