\r\nimport { defineConfig } from 'vite'\r\nimport vue from '@vitejs/plugin-vue'\r\nimport vueI18n from '@intlify/vite-plugin-vue-i18n'\r\n\r\n// https://vitejs.dev/config/\r\nconst path = require(\"path\")\r\nexport default defineConfig({\r\n test: {\r\n setupFiles: ['./tests/config.ts']\r\n },\r\n optimizeDeps: {\r\n exclude: ['vue-demi']\r\n },\r\n build: {\r\n lib: {\r\n entry: path.resolve(__dirname, 'src/install.ts'),\r\n name: 'vcp',\r\n formats: ['umd'],\r\n fileName: (format) => `vcp.${format}.ts`\r\n },\r\n rollupOptions: {\r\n external: ['vue', 'vueI18n', 'vue-demi',],\r\n output: {\r\n exports: 'named',\r\n globals: {\r\n 'vue-demi': 'VueDemi',\r\n 'vue': 'Vue',\r\n }\r\n }\r\n },\r\n },\r\n plugins: [\r\n vue({\r\n style: true,\r\n css: true\r\n }),\r\n vueI18n({\r\n include: path.resolve(__dirname, 'src/assets/translations.ts'),\r\n globalSFCScope: true,\r\n compositionOnly: false,\r\n }),\r\n ],\r\n server: {\r\n port: 8080\r\n },\r\n resolve: {\r\n dedupe: ['vue'],\r\n alias: {\r\n \"~\": path.resolve(__dirname, \"./src\"),\r\n \"@\": path.resolve(__dirname, \"./src\"),\r\n },\r\n },\r\n})\r\n\r\n```\r\n\r\npackage.json:\r\n```\r\n{\r\n \"name\": \"vcp\",\r\n \"version\": \"0.9.14\",\r\n \"private\": false,\r\n \"author\": \"Alireza Safari \u003Calireza.safaree@gmail.com> (http://alireza-safari.ir)\",\r\n \"license\": \"MIT\",\r\n \"main\": \"./dist/vcp.umd.ts\",\r\n \"description\": \"Vue Client Print with Template Builder\",\r\n \"exports\": {\r\n \".\": {\r\n \"require\": \"./dist/vcp.umd.ts\"\r\n },\r\n \"./dist/style.css\": \"./dist/style.css\"\r\n },\r\n \"keywords\": [\r\n \"vcp\",\r\n \"vue print\",\r\n \"vue client print\",\r\n \"template builder\",\r\n \"vue report\",\r\n \"vue report generator\"\r\n ],\r\n \"files\": [\r\n \"dist/*\"\r\n ],\r\n \"repository\": {\r\n \"type\": \"git\",\r\n \"url\": \"https://github.com/alireza0sfr/vue-client-print\"\r\n },\r\n \"scripts\": {\r\n \"dev\": \"vite\",\r\n \"build\": \"vite build\",\r\n \"serve\": \"vite preview\",\r\n \"test\": \"vitest run --environment jsdom\",\r\n \"test:ui:\": \"vitest --environment jsdom --ui\",\r\n \"test:coverage\": \"vitest run --coverage --environment jsdom\",\r\n \"test:watch\": \"vitest --environment jsdom\"\r\n },\r\n \"dependencies\": {\r\n \"dom-to-image\": \"^2.6.0\",\r\n \"file-saver\": \"^2.0.5\",\r\n \"jsdom\": \"^19.0.0\",\r\n \"print-js\": \"^1.6.0\",\r\n \"register-service-worker\": \"^1.7.2\",\r\n \"typescript\": \"^4.7.2\",\r\n \"vitest\": \"^0.12.9\",\r\n \"vue-demi\": \"^0.12.5\",\r\n \"vue-i18n\": \"^9.1.10\"\r\n },\r\n \"peerDependencies\": {\r\n \"vue\": \">=2.0.0 || >=3.0.0\"\r\n },\r\n \"devDependencies\": {\r\n \"@intlify/vite-plugin-vue-i18n\": \"^3.4.0\",\r\n \"@vitejs/plugin-vue\": \"^2.3.3\",\r\n \"@vitest/ui\": \"^0.12.9\",\r\n \"@vue/compiler-sfc\": \"^3.2.36\",\r\n \"@vue/test-utils\": \"^2.0.0-rc.18\",\r\n \"c8\": \"^7.11.3\",\r\n \"cz-conventional-changelog\": \"^3.0.1\",\r\n \"vite\": \"^2.9.9\",\r\n \"vue\": \"^3.2.36\"\r\n }\r\n}\r\n\r\n```",[],161,"createElementVNode is not a function vite","2022-10-27T15:14:22Z","https://github.com/vueuse/vue-demi/issues/161",0.6864705,{"description":3201,"labels":3202,"number":3206,"owner":3177,"repository":3177,"state":3179,"title":3207,"updated_at":3208,"url":3209,"score":3210},"### Clear and concise description of the problem\n\nI'm using `computedAsync` with the `evaluating` flag to show a visual indicator. When the dependencies of the is async function change, the indicator blinks as the `evaluating` ref gets set to `false` then back to `true` in quick succession.\r\n\r\nIt is not possible in the API surface to detect whether the `evaluating` flag was set as a result of evaluation actually finishing or the previous attempt being canceled for a new attempt.\n\n### Suggested solution\n\nModify the `evaluating` flag to change the value to not blink when canceling an evaluation\n\n### Alternative\n\n1. Wrap the `evaluating` flag in a `refDebounced` to prevent undesirable brief changes\r\n3. Add a new options, parallel to the `evaluating` argument, that tells whether this ref has an in-progress computation.\n\n### Additional context\n\n_No response_\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 that request the same feature to avoid creating a duplicate.",[3203],{"name":3204,"color":3205},"enhancement","a2eeef",3668,"Need a way to watch computedAsync that doesn't bounce","2025-01-24T13:05:47Z","https://github.com/vueuse/vueuse/issues/3668",0.6960557,{"description":3212,"labels":3213,"number":1454,"owner":3177,"repository":3214,"state":3179,"title":3215,"updated_at":3216,"url":3217,"score":3218},"I'm getting this error when trying to use in my **Vue3** project. Anybody encountered this before?\r\n\r\n> TypeError: Cannot read properties of undefined (reading 'version')\r\n> at eval (index.mjs?4c81:15)\r\n> at Module../node_modules/@vueuse/sound/node_modules/vue-demi/lib/index.mjs (home.js:59)\r\n> at __webpack_require__ (app.js:854)\r\n> at fn (app.js:151)\r\n> at eval (index.js?af75:1)\r\n> at Module../node_modules/@vueuse/sound/dist/esm/index.js (home.js:35)\r\n> at __webpack_require__ (app.js:854)\r\n> at fn (app.js:151)\r\n> at eval (cjs.js?!./node_modules/babel-loader/lib/index.js!./node_modules/cache-loader/dist/cjs.js?!./node_modules/vue-loader-v16/dist/index.js?!./src/views/Game.vue?vue&type=script&lang=js:3)\r\n> at Module../node_modules/cache-loader/dist/cjs.js?!./node_modules/babel-loader/lib/index.js!./node_modules/cache-loader/dist/cjs.js?!./node_modules/vue-loader-v16/dist/index.js?!./src/views/Game.vue?vue&type=script&lang=js (home.js:131)\r\n\r\nBasically, what I'm trying to achieve is to _play the audio when user clicks 'yes' on the `\u003CModal />` component which emits startGame_\r\n\r\nHere is the code:\r\n```\r\n\u003Ctemplate>\r\n \u003CModal @startGame=\"startGame\" />\r\n\u003C/template>\r\n\r\n\u003Cscript>\r\nimport { useSound } from '@vueuse/sound'\r\nimport bgAudio from '@/assets/audio/stranger-things.mp3'\r\n\r\nexport default {\r\n setup() {\r\n const { play } = useSound(bgAudio)\r\n\r\n const startGame = () => {\r\n /* other codes here */\r\n play()\r\n }\r\n return {\r\n startGame\r\n }\r\n }\r\n}\r\n\u003C/script>\r\n```\r\n",[],"sound","TypeError: Cannot read properties of undefined (reading 'version')","2022-11-25T02:10:33Z","https://github.com/vueuse/sound/issues/17",0.69864607,{"description":3220,"labels":3221,"number":3225,"owner":3177,"repository":3178,"state":3179,"title":3226,"updated_at":3227,"url":3228,"score":3229},"I have a problem after migrating a project to `vue@2.7`.\r\n\r\nBefore the migration, this was the setup:\r\nlibrary: `vue-demi@0.13.6`\r\nproject1: `vue@2.6`\r\nproject2: `vue@3.1`\r\n\r\nEverything was working fine until we migrated project1 to `vue@2.7`. \r\nAfter the migration, we get this error whenever we import something from `vue-demi` in the `library`:\r\n\r\n```\r\n11:00:16 [vite] Error when evaluating SSR module /@fs/Users/facundo.allemand/projects/traveler-frontend/node_modules/.pnpm/@getyourguide+compass@1.5.26-beta.49_typescript@4.4.3+vue@2.7.8/node_modules/@getyourguide/compass/index.ts?v=e717953f:\r\nTypeError: __vite_ssr_import_0__.defineComponent is not a function\r\n at eval (/@fs/Users/facundo.allemand/projects/traveler-frontend/node_modules/.pnpm/@getyourguide+compass@1.5.26-beta.49_typescript@4.4.3+vue@2.7.8/node_modules/@getyourguide/compass/components/c-button/c-button.vue:33:41)\r\n at async instantiateModule (/Users/facundo.allemand/projects/traveler-frontend/node_modules/.pnpm/vite@2.8.4_sass@1.49.7/node_modules/vite/dist/node/chunks/dep-971d9e33.js:56177:9)\r\n```\r\n\r\nThis is the example content of the component producing the error:\r\n```html\r\n\u003Ctemplate>\r\n \u003Cbutton>TEST\u003C/button>\r\n\u003C/template>\r\n\r\n\u003Cscript lang=\"ts\">\r\nimport { defineComponent } from \"vue-demi\";\r\n\r\nexport default defineComponent({\r\n name: \"CButton\",\r\n});\r\n\u003C/script>\r\n```\r\n\r\nWe have the `exclude: [\"vue-demi\"],` from the vite config, and we followed all the setup instructions.",[3222],{"name":3223,"color":3224},"needs reproduction","fcd735",182,"After upgrade to 2.7: __vite_ssr_import_0__.defineComponent is not a function","2022-09-04T15:40:00Z","https://github.com/vueuse/vue-demi/issues/182",0.7039458,{"description":3231,"labels":3232,"number":3233,"owner":3177,"repository":3214,"state":3179,"title":3234,"updated_at":3235,"url":3236,"score":3237},"I only get the error in the image\r\n\r\n\r\n",[],27,"Not working with Vue3 & Vite3","2022-11-29T18:47:48Z","https://github.com/vueuse/sound/issues/27",0.70693344,{"description":3239,"labels":3240,"number":3241,"owner":3177,"repository":3178,"state":3242,"title":3243,"updated_at":3244,"url":3245,"score":3246},"I'm trying to set up a component library with vue-demi (Vite + Vue 3 + Setup Script). Importing thing work fine in Vue 3 apps, but fail for Vue 2. The resulting bundle looks like this:\r\n\r\nBaseButton.vue to be imported by Vue2/3 App\r\n```vue\r\n\u003Cscript setup lang=\"ts\">\r\nimport { ref } from \"vue-demi\";\r\n\r\ndefineProps({\r\n label: {\r\n type: String,\r\n default: \"\",\r\n },\r\n});\r\n\r\nconst counter = ref(0);\r\n\u003C/script>\r\n\r\n\u003Ctemplate>\r\n \u003Clabel>\r\n {{ label }}\r\n {{ counter }}\r\n \u003Cbutton v-bind=\"$attrs\" @click=\"counter++\">\r\n \u003Cslot />\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.6702109,{"description":3248,"labels":3249,"number":591,"owner":3177,"repository":3178,"state":3242,"title":3250,"updated_at":3251,"url":3252,"score":3253},"Hello @antfu,\r\n\r\nI am facing a strange issue while using `v6.0 ` of the `vue-demi` package in my project. I have a global 'store' which can also be accessed outside of the Vue-context (e.g. in `main.ts`). The `Vue.use(VueCompositionApi)` call is made before calling any composition-api related functions.\r\n\r\n```javascript\r\nimport { computed, reactive } from \"@vue/composition-api\"\r\nimport { toReadonlyState } from \"@/utils/composition\"\r\n\r\ninterface GeneralStore {\r\n token: string | null\r\n isAuthenticated: boolean\r\n isTranslationPresent: boolean\r\n translationError: boolean\r\n}\r\n\r\nconst state = reactive\u003CGeneralStore>({\r\n token: null,\r\n isAuthenticated: false,\r\n isTranslationPresent: false,\r\n translationError: false,\r\n})\r\n\r\nexport function useGeneralStore() {\r\n const mutations = {\r\n setToken: (token?: string) => {\r\n state.token = token ?? null\r\n },\r\n setIsAuthenticated: (isAuthenticated: boolean) => {\r\n state.isAuthenticated = isAuthenticated\r\n },\r\n setIsTranslationPresent: (isTranslationPresent: boolean) => {\r\n state.isTranslationPresent = isTranslationPresent\r\n },\r\n setTranslationError: (translationError: boolean) => {\r\n state.translationError = translationError\r\n },\r\n }\r\n\r\n return {\r\n ...toReadonlyState(state),\r\n ...mutations,\r\n }\r\n}\r\n\r\n```\r\n\r\nAfter upgrading vue-demi to `v6.0` the whole Vue2 application crashes on load with the following error:\r\n\r\n```\r\nUncaught TypeError: Cannot read property 'observable' of undefined\r\n at ht (vue-composition-api.esm.js:563)\r\n ah gt (vue-composition-api.esm.js:673)\r\n ...\r\n```\r\n\r\nIt seems Vue is undefined here...\r\n\r\n```javascript\r\n// vue-composition-api.esm.js\r\nfunction reactive(obj) {\r\n if ((process.env.NODE_ENV !== 'production') && !obj) {\r\n warn('\"reactive()\" is called without provide an \"object\".');\r\n // @ts-ignore\r\n return;\r\n }\r\n if (!(isPlainObject(obj) || isArray(obj)) ||\r\n isRaw(obj) ||\r\n !Object.isExtensible(obj)) {\r\n return obj;\r\n }\r\n var observed = observe(obj); // FIXME: this call crashes due to Vue = undefined (line 673)\r\n setupAccessControl(observed);\r\n return observed;\r\n}\r\n```\r\n\r\n```javascript\r\n// vue-composition-api.esm.js\r\nfunction observe(obj) {\r\n var Vue = getRegisteredVueOrDefault();\r\n var observed;\r\n if (Vue.observable) { // FIXME: Vue is undefined here (line 563)\r\n observed = Vue.observable(obj);\r\n }\r\n else {\r\n var vm = defineComponentInstance(Vue, {\r\n data: {\r\n $$state: obj,\r\n },\r\n });\r\n observed = vm._data.$$state;\r\n }\r\n // in SSR, there is no __ob__. Mock for reactivity check\r\n if (!hasOwn(observed, '__ob__')) {\r\n def(observed, '__ob__', mockObserver(observed));\r\n }\r\n return observed;\r\n}\r\n```",[],"[v.6.0] Vue undefined while using reactive","2021-01-17T12:08:44Z","https://github.com/vueuse/vue-demi/issues/28",0.67214555,{"description":3255,"labels":3256,"number":3257,"owner":3177,"repository":3177,"state":3242,"title":3258,"updated_at":3259,"url":3260,"score":3261},"I'm running into typescript errors when trying to build a project using vite and vue-tsc (Vue 3 with typescript).\r\n\r\nThese are the errors that I get:\r\n\r\n\r\n\r\nWhen running the project in dev mode, it builds successfully.\r\n\r\nDid anyone else experience anything similar? ",[],829,"Errors building with \"vue-tsc --noEmit && vite build\"","2021-10-07T13:58:09Z","https://github.com/vueuse/vueuse/issues/829",0.68136466,["Reactive",3263],{},["Set"],["ShallowReactive",3266],{"$fTRc1wZytZ_XrK4EfJfei_Sz-An4H4Yy6syhVxH_PVJc":-1,"$fR1eys-p2kXDxVZJfxIiYaXOIRyPEQWlOgY8ErlQd5Wk":-1},"/vueuse/vue-demi/69"]