crxjs / chrome-extension-tools

Bundling Chrome Extensions can be pretty complex. It doesn't have to be.
https://crxjs.dev/vite-plugin
2.95k stars 190 forks source link

HMR not working #802

Open rendomnet opened 1 year ago

rendomnet commented 1 year ago

Build tool

Rollup

Where do you see the problem?

Describe the bug

When I change the content of my Components HMR is not working. You can try to change content of HelloWorld.vue in my repro. Newtab or popup will not change.

Reproduction

https://github.com/rendomnet/vite-crx-demo

Logs

No response

System Info

System:
    OS: Windows 10 10.0.22621
    CPU: (12) x64 AMD Ryzen 5 3600 6-Core Processor
    Memory: 16.97 GB / 31.93 GB
  Binaries:
    Node: 18.16.0 - C:\Program Files\nodejs\node.EXE
    Yarn: 1.22.19 - C:\Program Files\nodejs\yarn.CMD
    npm: 9.5.1 - C:\Program Files\nodejs\npm.CMD
    pnpm: 8.5.0 - C:\Program Files\nodejs\pnpm.CMD
  Browsers:
    Edge: Spartan (44.22621.2283.0), Chromium (117.0.2045.47)
    Internet Explorer: 11.0.22621.1
  npmPackages:
    @crxjs/vite-plugin: 2.0.0-beta.19 => 2.0.0-beta.19 
    vite: ^4.4.5 => 4.4.5

Severity

blocking an upgrade

mubaidr commented 1 year ago

I noticed syntax error here: https://github.com/rendomnet/vite-crx-demo/blob/f6a5b831f9c8d1d157ee5bd9fee745f94ed3b245/manifest.json#L18

BTW you can check my template here: https://github.com/mubaidr/vite-vue3-chrome-extension-v3?tab=readme-ov-file#vite-vue3-browser-extension-v3

TheSynt4x commented 1 year ago

I noticed syntax error here: https://github.com/rendomnet/vite-crx-demo/blob/f6a5b831f9c8d1d157ee5bd9fee745f94ed3b245/manifest.json#L18

BTW you can check my template here: https://github.com/mubaidr/vite-vue3-chrome-extension-v3?tab=readme-ov-file#vite-vue3-browser-extension-v3

I've tried your template and HMR changes do not persist across the board. HMR lags behind 1-2 changes for me, I've tried a new project and I've tried your template, and both do result in that behavior. If you know a workaround/fix, please do mention it.

Thanks!