\r\n \u003C/button>\r\n \u003C/label>\r\n\u003C/template>\r\n```\r\n\r\nBuild output:\r\n```js\r\nimport { defineComponent, ref, openBlock, createElementBlock, createTextVNode, toDisplayString, createElementVNode, mergeProps, renderSlot } from \"vue\";\r\nconst _sfc_main = /* @__PURE__ */ defineComponent({\r\n props: {\r\n label: {\r\n type: String,\r\n default: \"\"\r\n }\r\n },\r\n setup(__props) {\r\n const counter = ref(0);\r\n return (_ctx, _cache) => {\r\n return openBlock(), createElementBlock(\"label\", null, [\r\n createTextVNode(toDisplayString(__props.label) + \" \" + toDisplayString(counter.value) + \" \", 1),\r\n createElementVNode(\"button\", mergeProps(_ctx.$attrs, {\r\n onClick: _cache[0] || (_cache[0] = ($event) => counter.value++)\r\n }), [\r\n renderSlot(_ctx.$slots, \"default\")\r\n ], 16)\r\n ]);\r\n };\r\n }\r\n});\r\nexport { _sfc_main as BaseButton };\r\n```\r\n\r\nIn Vue 2 I run into `Uncaught TypeError: Object(...) is not a function` error with `defineComponent()`. I suppose it should be importing from \"vue-demi\" instead of \"vue\"?\r\n\r\nPackage.json\r\n```json\r\n\"dependencies\": {\r\n \"vue-demi\": \"^0.12.4\"\r\n },\r\n \"devDependencies\": {\r\n \"@types/node\": \"^17.0.21\",\r\n \"@vitejs/plugin-vue\": \"^2.2.0\",\r\n \"@vue/composition-api\": \"^1.4.9\",\r\n \"typescript\": \"^4.5.4\",\r\n \"vite\": \"^2.8.0\",\r\n \"vue\": \"^3.2.25\",\r\n \"vue-tsc\": \"^0.29.8\"\r\n },\r\n \"peerDependencies\": {\r\n \"@vue/composition-api\": \"^1.0.0-rc.1\",\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```\r\n\r\nvite.config.ts\r\n```ts\r\nexport default defineConfig({\r\n plugins: [vue()],\r\n build: {\r\n lib: {\r\n entry: path.resolve(__dirname, \"src/lib.ts\"),\r\n name: \"myLib\",\r\n fileName: (format) => `lib.${format}.js`,\r\n },\r\n rollupOptions: {\r\n // make sure to externalize deps that shouldn't be bundled\r\n // into your library\r\n external: [\"vue\"],\r\n output: {\r\n // Provide global variables to use in the UMD build\r\n // for externalized deps\r\n globals: {\r\n vue: \"Vue\",\r\n },\r\n },\r\n },\r\n },\r\n optimizeDeps: {\r\n exclude: [\"vue-demi\"],\r\n },\r\n});\r\n```",[],145,"closed","Not running on Vue 2 App","2022-09-04T15:48:05Z","https://github.com/vueuse/vue-demi/issues/145",0.69362247,{"description":2910,"labels":2911,"number":2915,"owner":2853,"repository":2853,"state":2904,"title":2916,"updated_at":2917,"url":2918,"score":2919},"When using it in yarn workspaces / lerna environment, the library throws an error with the following structure\r\n- testproject\r\n- - node_modules\r\n- - - @vueuse\r\n- - - vue-demi\r\n- - packages\r\n- - - my-module\r\n- - - - node_modules\r\n- - - - index.ts with import vueuse from '@vueuse/core'\r\n\r\n\r\n\r\n```\r\nWARNING Compiled with 1 warnings 7:45:35 PM\r\n\r\n warning in /Users/chetzof/Work/testproject/node_modules/@vueuse/core/dist/index.esm.js\r\n\r\n\"export 'createApp' was not found in 'vue-demi'\r\n\r\nModuleDependencyWarning: \"export 'createApp' was not found in 'vue-demi'\r\n at Compilation.reportDependencyErrorsAndWarnings (/Users/chetzof/Work/testproject/node_modules/webpack/lib/Compilation.js:1459:23)\r\n at /Users/chetzof/Work/testproject/node_modules/webpack/lib/Compilation.js:1258:10\r\n at AsyncSeriesHook.eval [as callAsync] (eval at create (/Users/chetzof/Work/testproject/node_modules/tapable/lib/HookCodeFactory.js:33:10), \u003Canonymous>:18:1)\r\n at AsyncSeriesHook.lazyCompileHook (/Users/chetzof/Work/testproject/node_modules/tapable/lib/Hook.js:154:20)\r\n at Compilation.finish (/Users/chetzof/Work/testproject/node_modules/webpack/lib/Compilation.js:1253:28)\r\n at /Users/chetzof/Work/testproject/node_modules/webpack/lib/Compiler.js:672:17\r\n at eval (eval at create (/Users/chetzof/Work/testproject/node_modules/tapable/lib/HookCodeFactory.js:33:10), \u003Canonymous>:9:1)\r\n at /Users/chetzof/Work/testproject/node_modules/webpack/lib/Compilation.js:1185:12\r\n at /Users/chetzof/Work/testproject/node_modules/webpack/lib/Compilation.js:1097:9\r\n at processTicksAndRejections (internal/process/task_queues.js:79:11)\r\n at HarmonyImportSpecifierDependency._getErrors (/Users/chetzof/Work/testproject/node_modules/webpack/lib/dependencies/HarmonyImportSpecifierDependency.js:109:11)\r\n at HarmonyImportSpecifierDependency.getWarnings (/Users/chetzof/Work/testproject/node_modules/webpack/lib/dependencies/HarmonyImportSpecifierDependency.js:60:15)\r\n at Compilation.reportDependencyErrorsAndWarnings (/Users/chetzof/Work/testproject/node_modules/webpack/lib/Compilation.js:1454:24)\r\n at /Users/chetzof/Work/testproject/node_modules/webpack/lib/Compilation.js:1258:10\r\n at AsyncSeriesHook.eval [as callAsync] (eval at create (/Users/chetzof/Work/testproject/node_modules/tapable/lib/HookCodeFactory.js:33:10), \u003Canonymous>:18:1)\r\n at AsyncSeriesHook.lazyCompileHook (/Users/chetzof/Work/testproject/node_modules/tapable/lib/Hook.js:154:20)\r\n at Compilation.finish (/Users/chetzof/Work/testproject/node_modules/webpack/lib/Compilation.js:1253:28)\r\n at /Users/chetzof/Work/testproject/node_modules/webpack/lib/Compiler.js:672:17\r\n at eval (eval at create (/Users/chetzof/Work/testproject/node_modules/tapable/lib/HookCodeFactory.js:33:10), \u003Canonymous>:9:1)\r\n at /Users/chetzof/Work/testproject/node_modules/webpack/lib/Compilation.js:1185:12\r\n at /Users/chetzof/Work/testproject/node_modules/webpack/lib/Compilation.js:1097:9\r\n at processTicksAndRejections (internal/process/task_queues.js:79:11)\r\n```\r\n\r\nafter i copy `testproject/node_modules/@vueuse` to `testproject/packages/my-module/node_modules` the error goes away",[2912],{"name":2913,"color":2914},"needs reproduction","f2f08a",259,"The library does not work properly in a monorepo configuration","2021-10-28T06:46:30Z","https://github.com/vueuse/vueuse/issues/259",0.70625085,{"description":2921,"labels":2922,"number":2923,"owner":2853,"repository":2853,"state":2904,"title":2924,"updated_at":2925,"url":2926,"score":2927},"### Describe the bug\r\n\r\nIt seems when in vue3 project, it still import vue-demi.\r\n\r\nWhen i down to 8.9.3, problem solved.\r\n\r\n```\r\n10:14:49 AM [vite] Internal server error: Failed to resolve import \"vue-demi\" from \"node_modules/.vite/deps/chunk-KBM4AKY4.js?v=49be3b31\". Does the file exist?\r\n Plugin: vite:import-analysis\r\n File: /Users/alex.xie/code/divzen-web/node_modules/.vite/deps/chunk-KBM4AKY4.js?v=49be3b31\r\n 1 | // node_modules/.pnpm/@vueuse+shared@8.9.4_vue@3.2.37/node_modules/@vueuse/shared/index.mjs\r\n 2 | import { shallowRef, watchEffect, readonly, ref, unref, isVue3, watch, customRef, effectScope, provide, inject, getCurrentScope, onScopeDispose, isRef, computed, reactive, toRefs as toRefs$1, toRef, isVue2, set as set$1, getCurrentInstance, onBeforeMount, nextTick, onBeforeUnmount, onMounted, onUnmounted, isReactive } from \"vue-demi\";\r\n | ^\r\n 3 | var __defProp$9 = Object.defineProperty;\r\n 4 | var __defProps$6 = Object.defineProperties;\r\n```\r\n\r\n### Reproduction\r\n\r\ni may put it later\r\n\r\n### System Info\r\n\r\n```Shell\r\nSystem:\r\n OS: macOS 12.4\r\n CPU: (8) x64 Intel(R) Core(TM) i7-1068NG7 CPU @ 2.30GHz\r\n Memory: 499.36 MB / 16.00 GB\r\n Shell: 5.8.1 - /bin/zsh\r\n Binaries:\r\n Node: 16.14.2 - ~/.nvm/versions/node/v16.14.2/bin/node\r\n Yarn: 1.22.17 - ~/.yarn/bin/yarn\r\n npm: 8.5.5 - ~/.config/yarn/global/node_modules/.bin/npm\r\n Browsers:\r\n Chrome: 103.0.5060.114\r\n Firefox: 89.0\r\n Safari: 15.5\r\n npmPackages:\r\n @vueuse/core: 8.9.4 => 8.9.4 \r\n vue: ^3.2.37 => 3.2.37\r\n```\r\n\r\n\r\n### Used Package Manager\r\n\r\npnpm\r\n\r\n### Validations\r\n\r\n- [X] Follow our [Code of Conduct](https://github.com/vueuse/vueuse/blob/main/CODE_OF_CONDUCT.md)\r\n- [X] Read the [Contributing Guidelines](https://github.com/vueuse/vueuse/blob/main/CONTRIBUTING.md).\r\n- [X] Read the [docs](https://vueuse.org/guide).\r\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.\r\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.\r\n- [X] Check that this is a concrete bug. For Q&A open a [GitHub Discussion](https://github.com/vueuse/vueuse/discussions).\r\n- [X] The provided reproduction is a [minimal reproducible example](https://stackoverflow.com/help/minimal-reproducible-example) of the bug.",[],1953,"v8.9.4 will break vue3 project?","2022-07-19T05:57:43Z","https://github.com/vueuse/vueuse/issues/1953",0.70881265,{"description":2929,"labels":2930,"number":2931,"owner":2853,"repository":2854,"state":2904,"title":2932,"updated_at":2933,"url":2934,"score":2935},"I am using vue-cli-service to compile my library which uses vue-demi and I develop the code using vue 3.2.X.\r\nWhen I import the library in a vue2 project `vue-demi` detects vue3 is running instead of vue2.\r\n\r\nThis is a console log of following in my library, which I imported in my application.\r\n```js\r\nimport * as VueDemi from 'vue-demi';\r\nconsole.log(VueDemi)\r\n```\r\n\r\n\r\n\r\n\r\nHere's a repo to reproduce it \r\n[https://github.com/pareshchouhan/vue-demi-test](https://github.com/pareshchouhan/vue-demi-test) \r\n\r\nIn my library only thing I use vue-demi is for importing defineComponent\r\n\r\n```js\r\nimport { defineComponent } from 'vue-demi';\r\n````\r\n\r\nIt crashes inside the library code when calling `defineComponent`\r\n\r\n",[],121,"Library uses vue-demi with vue3, app uses vue2 but still vue-demi detects vue3","2021-12-02T15:13:46Z","https://github.com/vueuse/vue-demi/issues/121",0.7104936,["Reactive",2937],{},["Set"],["ShallowReactive",2940],{"$fTRc1wZytZ_XrK4EfJfei_Sz-An4H4Yy6syhVxH_PVJc":-1,"$fy963EA86sP_lEp8A0iC4bVYEpa1JGYrRvZ4JyAJOOUU":-1},"/vueuse/vue-demi/160"]