Vue Demi (half in French) is a developing utility
allows you to write Universal Vue Libraries for Vue 2 & 3
See more details in this blog post
Install this as your plugin’s dependency:
npm i vue-demi
# or
yarn add vue-demi
{
"dependencies": {
"vue-demi": "latest"
}
}
Import everything related to Vue from it, it will redirect to vue@2
@vue/composition-api
or vue@next
based on users’ environments.
import { ref, reactive, defineComponent } from 'vue-demi'
Publish your plugin and all is done!
See examples.
See the blog post.
Redirecting Reslove
If the script 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
Author: antfu
Source Code: https://github.com/antfu/vue-demi
#vuejs #javascript #vue