Description
First of all, I saw a couple of issues that involved more or less the same issue, but I tought it would be useful to group everything into one issue, so we could hopefully try to solve it.
Related issues:
- Not running on Vue 2 App #145
- Object() is not a function #136
- createElementVNode is not a function with @vue/cli #117
- Object(...) is not a function #129
Problem
I'm currently building a private reusable package for a real-world application. This application runs on nuxt2
(currently nuxt-bridge
), and we're planning to migrate to nuxt3
when all the packages we need are there. The idea was to build that reusable package in vue3
, and use vue-demi
to make it possible to be used in our nuxt-bridge
app.
At first I just tried building the library and use it in a separate vue 3 app. With Vite it was really fast & easy to make it work 🎉
However when I tried importing it in our nuxt-bridge
app I came across several issues:
-
When externalising
vue
dependency in vite, I got a list of warnings that some functions are not exported by vue. This is what the most issues are about. -
When I don't externalise
vue
invite.config.js
, I just get an empty component. In my repro I don't get any warning. I just see an anonymous component in my dev tools. In my production nuxt-app, I see the following error:no template or render function is defined
. The component seemed to be imported correctly, it just doesn't render any HTML. -
I saw in other issues that the solution might be to externalise
vue-demi
as well, but that doesn't seem to make any difference for this. -
also tried using
npx vue-demi-fix
&&npx vue-demi-switch 2
commands, but these also doesn't seem to be changing a whole lot.
I also saw that in #117 , @koooge researched into the issue a bit and saw that it might be due to a breaking change in @vue/core.
That's when I decided to build a repro with a vue2 app (@vue/cli), vue3 app (vite) and a simple component in a separate lib.
Repro
https://github.com/jclaessens97/vue-demi-vue2-broken-repro
I hope we can look into this issue and try to come up with a solution to be able to make vue3 components compatible for vue2, until everything is vue3 ready.