\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":2881,"labels":2882,"number":2886,"owner":2857,"repository":2857,"state":2859,"title":2887,"updated_at":2888,"url":2889,"score":2890},"### 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.",[2883],{"name":2884,"color":2885},"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":2892,"labels":2893,"number":2897,"owner":2857,"repository":2858,"state":2859,"title":2898,"updated_at":2899,"url":2900,"score":2901},"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.",[2894],{"name":2895,"color":2896},"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":2903,"labels":2904,"number":2905,"owner":2857,"repository":2858,"state":2906,"title":2907,"updated_at":2908,"url":2909,"score":2910},"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":2912,"labels":2913,"number":2914,"owner":2857,"repository":2858,"state":2906,"title":2915,"updated_at":2916,"url":2917,"score":2918},"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```",[],28,"[v.6.0] Vue undefined while using reactive","2021-01-17T12:08:44Z","https://github.com/vueuse/vue-demi/issues/28",0.67214555,{"description":2920,"labels":2921,"number":2922,"owner":2857,"repository":2857,"state":2906,"title":2923,"updated_at":2924,"url":2925,"score":2926},"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,{"description":2928,"labels":2929,"number":2930,"owner":2857,"repository":2857,"state":2906,"title":2931,"updated_at":2932,"url":2933,"score":2934},"I've created a project with vite+vue2(using plugin)+vueuse and it looks like vueuse doesn't work properly in this setup.\r\n\r\nThe error I get:\r\n\r\n```\r\nvue.runtime.esm.js:619 [Vue warn]: Error in data(): \"ReferenceError: ref3 is not defined\"\r\n\r\nfound in\r\n\r\n---> \u003CAnonymous>\r\n \u003CRoot>\r\nwarn @ vue.runtime.esm.js:619\r\nvue.runtime.esm.js:1888 ReferenceError: ref3 is not defined\r\n at Object.ref (index.esm.js:1)\r\n at useCounter (index.esm.js:698)\r\n at setup (App.vue:21)\r\n at mergedSetupFn (vue-composition-api.esm.js:1741)\r\n at vue-composition-api.esm.js:1527\r\n at activateCurrentInstance (vue-composition-api.esm.js:1454)\r\n at initSetup (vue-composition-api.esm.js:1525)\r\n at VueComponent.wrappedData (vue-composition-api.esm.js:1509)\r\n at getData (vue.runtime.esm.js:4748)\r\n at initData (vue.runtime.esm.js:4705)\r\n```\r\n\r\nI tried `useCounter` and `useStorage`, but I think it can be replicated with other methods.\r\n\r\nHere is the project link to replicate: \r\nhttps://github.com/localhost5001/vite-vue2-vueuse-template",[],485,"Incompatible with vite and vue2","2021-05-05T20:52:10Z","https://github.com/vueuse/vueuse/issues/485",0.6817507,{"description":2936,"labels":2937,"number":2938,"owner":2857,"repository":2858,"state":2906,"title":2939,"updated_at":2940,"url":2941,"score":2942},"Why v2.7 need exports warn\r\nAnd v2 and v3 do not need?\r\nIs it necessary? Can we remove it\r\n\r\n[lib/v2.7/index.cjs](https://github.com/vueuse/vue-demi/blob/main/lib/v2.7/index.cjs#L11)\r\n[lib/v2.7/index.d.ts](https://github.com/vueuse/vue-demi/blob/main/lib/v2.7/index.d.ts#L9)\r\n[lib/v2.7/index.mjs](https://github.com/vueuse/vue-demi/blob/main/lib/v2.7/index.mjs#L7)\r\n\r\n```\r\n> vite build\r\n\r\nfailed to load config from /workspaces/vue-demi-component-template/vue2.7-playground/vite.config.ts\r\nerror during build:\r\nTypeError: Cannot read properties of undefined (reading 'warn')\r\n at Object.\u003Canonymous> (/workspaces/vue-demi-component-template/node_modules/.pnpm/vue-demi@0.14.5_@vue+composition-api@1.7.1_vue@3.2.47/node_modules/vue-demi/lib/index.cjs:11:25)\r\n at Module._compile (node:internal/modules/cjs/loader:1275:14)\r\n at Module._extensions..js (node:internal/modules/cjs/loader:1329:10)\r\n at _require.extensions.\u003Ccomputed> [as .js] (file:///workspaces/vue-demi-component-template/node_modules/.pnpm/vite@4.2.1_@types+node@18.11.18/node_modules/vite/dist/node/chunks/dep-79892de8.js:63989:17)\r\n at Module.load (node:internal/modules/cjs/loader:1133:32)\r\n at Module._load (node:internal/modules/cjs/loader:972:12)\r\n at Module.require (node:internal/modules/cjs/loader:1157:19)\r\n at require (node:internal/modules/helpers:119:18)\r\n at Object.\u003Canonymous> (/workspaces/vue-demi-component-template/vue2.7-playground/vite.config.ts:43:23)\r\n at Module._compile (node:internal/modules/cjs/loader:1275:14)\r\n```\r\nReproduction:\r\n[https://github.com/Ariesly/vue-demi-component-template](https://github.com/Ariesly/vue-demi-component-template)\r\n\r\n```\r\npnpm install\r\n\r\npnpm build:2.7\r\n```\r\n",[],235,"about 2.7 exports Vue.util.warn ","2023-05-27T02:32:11Z","https://github.com/vueuse/vue-demi/issues/235",0.69560534,["Reactive",2944],{},["Set"],["ShallowReactive",2947],{"$fTRc1wZytZ_XrK4EfJfei_Sz-An4H4Yy6syhVxH_PVJc":-1,"$fR1eys-p2kXDxVZJfxIiYaXOIRyPEQWlOgY8ErlQd5Wk":-1},"/vueuse/vue-demi/69"]