Open moliyu opened 3 years ago
It is a bug.
This lib may have something wrong with unplugin-vue2-script-setup || vue-composition-api
.
unplugin-vue2-script-setup && vue-composition-api
works fine with this compiler.I will look into it and fix it ASAP.
Thanks for your feedback.
If anyone has interest to fix this issue, you can:
Try to reproduce this code snippet and error by setup DEMO Project.
Follow CONTRIBUTING.md to make a contribution.
Do you use VueCompositionAPI
?
I found the unplugin-vue2-script-setup && vue-composition-api
works fine with this compiler.
But if you forget to write Vue.use(VueCompositionAPI)
, there will be the same undefined error
as yours.
So try to add these to your main.ts
:
// main.ts || .js
import VueCompositionAPI from '@vue/composition-api'
Vue.use(VueCompositionAPI)
If your issue is still not resolved. Just let me know.
it can not work for me. here is my package.json
{
"private": true,
"scripts": {
"serve": "vue-cli-service serve",
"dev": "vue-cli-service serve",
"build": "vue-cli-service build"
},
"dependencies": {
"@vue/composition-api": "^1.3.3",
"@vueuse/core": "^6.7.6",
"vue": "^2.6.14"
},
"devDependencies": {
"@vue/cli-plugin-typescript": "^4.5.13",
"@vue/cli-service": "^4.5.13",
"@vue/runtime-dom": "^3.2.21",
"typescript": "^4.3.5",
"unplugin-vue2-script-setup": "^0.6.13",
"vue-template-babel-compiler": "^1.0.6-0",
"vue-template-compiler": "^2.6.14"
}
}
@JuniorTour it works fine with latest @vue/composition-api
thank you
I also made an Example project for vue-template-babel-compiler
&& VueUse
&& unplugin-vue2-script-setup
&& vuejs/composition-api