// the find
vueuse/vue-demi
🎩 Creates Universal Library for Vue 2 & 3
Vue Demi is a shim layer that lets library authors write a single codebase targeting both Vue 2 and Vue 3 by re-exporting the Composition API from whichever version the consumer has installed. It solves a real problem that existed during the Vue 2→3 migration window. The repo itself now carries a caution banner saying it should not be used for new projects and will be deprecated.
Adopted by serious projects (VueUse, TanStack Query, vue-apollo) which validates the approach works in production. The postinstall hook that auto-detects and switches the target version is clever — consumers don't have to think about it. Provides isVue2/isVue3 flags for the cases where you genuinely need version-specific code paths. The aliasing feature (vue-demi-switch 2 vue2) lets you run your test suite against both versions with npm aliases, which is the right way to do cross-version CI.
This is effectively a deprecated compatibility shim — the repo itself tells you not to use it for new projects. Vue 2 reached end-of-life in December 2023, so the problem this solves is shrinking every month. The postinstall script rewriting files on disk is fragile; it breaks in monorepos, certain CI caching setups, and with package managers that don't run postinstall by default (pnpm with some configs). The lib/ directory contains committed build artifacts, which is a maintenance smell — consumers can get stale binaries if the build isn't kept in sync with the source.