\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,"Not running on Vue 2 App","2022-09-04T15:48:05Z","https://github.com/vueuse/vue-demi/issues/145",0.65815336,{"description":2928,"labels":2929,"number":2930,"owner":2868,"repository":2869,"state":2914,"title":2931,"updated_at":2932,"url":2933,"score":2934},"Imports of `resolveDirective`, `withDirectives` and many other vue@3 modules are not found in `vue-demi` when used in vue@2 environments.\r\n\r\n```js\r\nimport {\r\n defineComponent,\r\n h,\r\n isVue2,\r\n resolveComponent,\r\n resolveDirective,\r\n withDirectives,\r\n vModelDynamic,\r\n vShow,\r\n} from 'vue-demi';\r\n```\r\n\r\nIn vue@2 environments this will result in an error like `\"export 'withDirectives' was not found in 'vue-demi'`.\r\n\r\nAny idea on how to handle these cases?",[],60,"resolveDirective, withDirectives and many other vue@3 modules are not found in vue-demi when used in vue@2 environments","2021-07-15T17:20:01Z","https://github.com/vueuse/vue-demi/issues/60",0.6603583,{"description":2936,"labels":2937,"number":2938,"owner":2868,"repository":2869,"state":2914,"title":2939,"updated_at":2940,"url":2941,"score":2942},"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.6679132,{"description":2944,"labels":2945,"number":2946,"owner":2868,"repository":2869,"state":2914,"title":2947,"updated_at":2948,"url":2949,"score":2950},"使用 @antv/x6-vue-shape 包时,出现以下问题:\r\n使用npm本地启动项目时,控制台出现:\r\n\r\n打开设计器页面出现以下问题:\r\n\r\n尝试过使用 vue-demi-fix 以及 vue-demi-switch 2 都没有解决。",[],207,"\"export 'defineComponent' was not found in 'vue-demi'","2025-01-02T03:38:26Z","https://github.com/vueuse/vue-demi/issues/207",0.6687708,["Reactive",2952],{},["Set"],["ShallowReactive",2955],{"$fTRc1wZytZ_XrK4EfJfei_Sz-An4H4Yy6syhVxH_PVJc":-1,"$flUuRAKfPmviOic00lRLLdr_nMaeN0sJWSZD3TIHzQEc":-1},"/vueuse/vue-demi/181"]