akxcv / vuera

:eyes: Vue in React, React in Vue. Seamless integration of the two. :dancers:
MIT License
4.3k stars 242 forks source link

A fix for vue class syntax components #71

Closed runebaas closed 5 years ago

runebaas commented 5 years ago

I also ran in into #48, unknowingly that there is already an issue for it i came to the same conclusion as @stlbucket.

It would be great if this issue would be fixed, i added a property to the prototype to see if a component is a vue component to make sure that there are no corner cases. I know it is not the cleanest solution but it works.

An alternative fix, without touching the prototype, would be to see if the version property exists, react doesn't expose this but vue does, however that may break at any point in time, especially when Vue 3.0 is released

akxcv commented 5 years ago

Hey! Thank you for this PR! I think that touching the prototype is OK for vuera. There's no "proper" way (that I know of) to distinguish between React and Vue components anyway, so I feel that it's totally fine for us to use hacks, and writing to Vue's prototype is better that playing a guessing game with properties that may or may not be in there in different versions.

Please fix the tests, and I will happily merge this!

runebaas commented 5 years ago

Awesome, thanks.

The tests are fixed, i've added the same thing to the test setup, because the VuePlugin is not loaded and the property doesn't exist.

runebaas commented 5 years ago

Would you mind creating a new release on NPM with this change please?

akxcv commented 5 years ago

Sure, hopefully will publish a new release this evening.

akxcv commented 5 years ago

Published 0.2.4 just now.

runebaas commented 5 years ago

Thanks! 😄