karol-f / vue-custom-element

Vue Custom Element - Web Components' Custom Elements for Vue.js
https://karol-f.github.io/vue-custom-element/
MIT License
1.97k stars 187 forks source link

Doesn't play nice with Decorated Typescript #266

Open johnnyshankman opened 2 years ago

johnnyshankman commented 2 years ago

When using: https://github.com/vuejs/vue-class-component

And exporting a component using @Component syntax, this plugin dies and complains about the following:

 Cannot read properties of undefined (reading '_init')

Non-decorated TS exports work just fine. Any help? Rewriting my whole codebase to be non-decorated would take quite some time.

https://github.com/karol-f/vue-custom-element#javascript---register-with-vue-custom-element

Seems to only understand this one very specific output.

Seems to trip over:

        var Sub = function VueComponent(options) {
            this._init(options);
        };

Problem to me seems that we already have a VueComponent, that's what @Component shims the output of your export to. Can we add a check to see if this is already done and support this other export type?

Me logging my export that gets passed in to the second param of Vue.customElement

Screen Shot 2022-07-31 at 4 13 36 PM
medialwerk commented 1 year ago

I think it is related to https://github.com/karol-f/vue-custom-element/issues/219