3.1k GitHub stars and counting โ vueuse/vue-demi is a JavaScript project TopGit is tracking across repositories on the platform. ๐ฉ Creates Universal Library for Vue 2 & 3
Snapshot summary built from the project's own GitHub metadata โ there's no written TopGit review yet. The page will update automatically when a full review is published.
WHY NO REVIEW YET
TopGit writes full reviews for the most-starred, most-requested repositories. This page is a snapshot until then โ see the READ ME tab for the original README in full.
Vue Demi provides extra APIs to help distinguish users' environments and to do some version-specific logic.
isVue2isVue3
import { isVue2, isVue3 } from 'vue-demi'
if (isVue2) {
// Vue 2 only
} else {
// Vue 3 only
}
Vue2
To avoid bringing in all the tree-shakable modules, we provide a Vue2 export to support access to Vue 2's global API. (See #41.)
import { Vue2 } from 'vue-demi'
if (Vue2) {
Vue2.config.ignoredElements.push('x-foo')
}
install()
Composition API in Vue 2 is provided as a plugin and needs to be installed on the Vue instance before using. Normally, vue-demi will try to install it automatically. For some usages where you might need to ensure the plugin gets installed correctly, the install() API is exposed to as a safe version of Vue.use(CompositionAPI). install() in the Vue 3 environment will be an empty function (no-op).
import { install } from 'vue-demi'
install()
CLI
Manually Switch Versions
To explicitly switch the redirecting version, you can use these commands in your project's root.
npx vue-demi-switch 2
# or
npx vue-demi-switch 3
Package Aliasing
If you would like to import vue under an alias, you can use the following command
npx vue-demi-switch 2 vue2
# or
npx vue-demi-switch 3 vue3
Then vue-demi will redirect APIs from the alias name you specified, for example:
import * as Vue from 'vue3'
var isVue2 = false
var isVue3 = true
var Vue2 = undefined
export * from 'vue3'
export {
Vue,
Vue2,
isVue2,
isVue3,
}
Auto Fix
If the postinstall hook doesn't get triggered or you have updated the Vue version, try to run the following command to resolve the redirecting.
npx vue-demi-fix
Isomorphic Testings
You can support testing for both versions by adding npm alias in your dev dependencies. For example:
The most recent commit recorded on vueuse/vue-demi was 1.8 years ago, based on the GitHub push timestamp. The repository has 171 forks โ one of the better signals of community interest.
How does vueuse/vue-demi compare to other Frontend projects?
vueuse/vue-demi is tracked by TopGit in the Frontend category, with 3.1k GitHub stars and written in JavaScript. Browse the Frontend topic page on TopGit to compare it against similar projects by stars and activity.
How many stars does vueuse/vue-demi have?
vueuse/vue-demi has 3.1k GitHub stars โ refresh the page for the live number, or check github.com/vueuse/vue-demi. TopGit mirrors GitHub's count but does not claim minute-by-minute accuracy.
Is vueuse/vue-demi open source?
Yes โ vueuse/vue-demi ships under the MIT license, which makes its source code freely readable (and, depending on license terms, forkable and reusable). Source: github.com/vueuse/vue-demi.
What is vueuse/vue-demi?
vueuse/vue-demi (vueuse/vue-demi) is a JavaScript project on GitHub. From the project's own README: ๐ฉ Creates Universal Library for Vue 2 & 3
Where do I read more about vueuse/vue-demi?
This TopGit page is a snapshot โ the READ ME tab shows the project's own README content (links stripped, images preserved). The GitHub repository at github.com/vueuse/vue-demi is the definitive source.
Read full README in the tab above.
Curious whether vue-demi is right for you?
Let ChatGPT, Claude, or Perplexity look into it โ click below and see what AI actually says about vue-demi.