antfu / reactivue

🙊 Use Vue Composition API in React components

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Update example for Vite 2

antfu opened this issue · comments

Update example for Vite 2

Hi, @antfu

I have tried it updating example to Vite 2. It works fine but pinia@2.0.0-alpha.6 doesn't work.

Because it is importing warn, inject, getCurrentInstance from vue which is now alias to reactivue in example. But reactivue doesn't export these variables. Actually getCurrentInstance is exported, but it is unrelated to vue.

https://github.com/posva/pinia/blob/502a32832cfdb1a27a033ba2b7be578b090697de/src/store.ts#L1
https://github.com/posva/pinia/blob/c949b80391cae322f024b8cc369be351d5d6a693/src/rootStore.ts#L1

Maybe we should remove pinia for now? What you think?

My branch https://github.com/sibbng/reactivue/tree/update-example

Would the older version of pinia works?

I think maybe we can mock those apis for compatibility.

Would the older version of pinia works?

Yes it works if we just upgrade vite. Here it is a branch only with vite 2 upgrade.
https://github.com/sibbng/reactivue/tree/update-vite

Can you just try updating vueuse on this branch. I have faced with some errors about related to aliasing vue-demi to reactivue.

You shall have the write access to this repo, would you mind to push the branch directly? Thanks.

Done. I notice when I update React to 16.14.0, the useMouse and useBattery from VueUse becomes not reactive. Not sure why, guess you are more familiar with React, can you have a look? Thanks.

@antfu I can take a look at why the upgrade broke things if you'd like

Done. I notice when I update React to 16.14.0, the useMouse and useBattery from VueUse becomes not reactive. Not sure why, guess you are more familiar with React, can you have a look? Thanks.

Just useMouse and useBattery? As far as I see everything is broken. Looks like my Strict mode fixes broke the normal mode.

@crutchcorn that will be great, thanks!

@sibbng Uhm, idk, just saw them broken but other's works to me

Fixed in 3aef4b8

Only caveat of this: instance ids are increasing twice on dev.

@antfu I have rebased update-vite. Can you test it now?

Only caveat of this: instance ids are increasing twice on dev.

This could cause instance values to be overwritten. Fixed in 8be6d01