antfu-collective / vitesse-webext

⚡️ WebExtension Vite Starter Template
MIT License
2.9k stars 224 forks source link

Fix HMR in contentScript App by using an iframe #139

Open louisremi opened 1 year ago

louisremi commented 1 year ago

Clear and concise description of the problem

Since WebExtension's Manifest v3, HMR in content script is broken and disabled in this repo. (see manifest.ts).

Suggested solution

Although I don't have a solution to prevent having to manually reload the extension when updating the contentScript, there is a solution to inject an app in the current tab with functional HMR: the solution is to inject an iframe with a source pointing to another Vue app in the repo, similar to the options or popup app.

I have a working POC over on my fork: https://github.com/louisremi/vite-react-webext-with-sidebar (where I also switched from Vue to React for my personnal needs).

Let me know if you think this could be an interesting fix/addition to this repo

Alternative

No response

Additional context

No response

Validations

brauliobo commented 4 months ago

HMR on content script is broken here too