antfu / vitesse-webext

⚡️ WebExtension Vite Starter Template

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Replace Vue with React

id3vz opened this issue · comments

commented

Thanks for this great work!
Is there any way to replace Vue with React?

Should be straight forward to change the two main.ts to react dom and replace vite plugin in vite.config.ts

commented

I think its not that straight forward, because of error: 'vite-plugin-react can't detect preamble. Something is wrong'. Actually this error linked to this PR, but it is not clear how to solve in our case

https://github.com/quolpr/react-vite-webext

I made the react version, but I disabled HMR. It is still fixable though, I am going to fix it later

Best quick solution is to disable fast refresh in the react plugin:

// vite.config.ts
react({ fastRefresh: false })

This doesn't require the inline script.