privatenumber / vue-2-3

↔️ Interop Vue 2 components in Vue 3 apps and vice versa
MIT License
281 stars 10 forks source link

Uncaught TypeError: t is not a constructor #3

Closed cloydlau closed 3 years ago

cloydlau commented 3 years ago

Hello, I did what the doc said but error occured. (Using in Vue-Cli)

Uncaught TypeError: t is not a constructor
    at Proxy.mounted (to-vue-3.js)

Here is the minimal reproducible demo: https://codesandbox.io/s/vigilant-leakey-u00rf?file=/src/App.vue

In Vite either:

Uncaught Error: Vue 2 & 3 were not resolved with bare specifiers "vue" & "vue3". Register them with toVue3.register(Vue2, Vue3)
    at d (to-vue-3.js:1)
privatenumber commented 3 years ago

Thanks for the reproduction link.

The problem is with your project setup rather than with vue-2-3. vue2 is pointing to this package which isn't actually Vue. CodeSandbox doesn't seem to support package aliasing right now so I opened a feature request here.

If your project is local, alias vue2 to the actual Vue by doing: npm install vue2@npm:vue@^2.6.12

You can see JsonEditorVue successfully run in a Vue3 app here.