- Building Universal Vue Libraries for Vue 2 & 3
- Using vue-demi but you don't need to write "render" function, "template" and "tsx" are supported!
yarn
yarn run dev
yarn run build
Change package name, publish and install it to test in vue2/3
If you want to use 'npm link' project locally, you need to edit "package.module" "package.main" according to vue version.
// vue2
{
"name": "your-component",
"module": "./dist/vue2/index.es.js",
"main": "./dist/vue2/index.umd.js",
...
}
// vue3
{
"name": "your-component",
"module": "./dist/vue3/index.es.js",
"main": "./dist/vue3/index.umd.js",
...
}
Install 'universal-vue-template' which built by this template in vue2 or vue3, it will work correctly.
yarn add universal-vue-template
import Universal from 'universal-vue-template'
import 'universal-vue-template/dist/style.css'