aklinker1 / vite-plugin-web-extension

Vite plugin for developing Chrome/Web Extensions
https://vite-plugin-web-extension.aklinker1.io/
MIT License
574 stars 48 forks source link

Scripts missing when rebuilding HTML on Watch Mode #7

Closed ChrRubin closed 2 years ago

ChrRubin commented 2 years ago

When using vite build --watch, making changes to HTML files (whether vanilla HTML or via frameworks like Vue) will trigger a rebuild, but only HTML pages are rebuilt, causing all content and background scripts to be missing from the output folder until the command is run again.

This can be reproduced on both the vanilla and vue demos included in the repo.

aklinker1 commented 2 years ago

Thanks for the report, I had manually worked around this in one of my personal extensions by setting build.emptyOutDir to false, and manually deleting the output dir with fs.rmdirSync("dist", { recursive: true });.

As of v1.0.5, this is done automatically for you when you pass build.emptyOutDir = true! Let me know if it doesn't work for you

aklinker1 commented 2 years ago

Fixed by https://github.com/aklinker1/vite-plugin-web-extension/commit/a9642ce62c6a4611a5a49e8479c78f52653bb885