crxjs / chrome-extension-tools

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

popup freezes on 'vite dev mode' after switching branches #900

Open Toumash opened 2 months ago

Toumash commented 2 months ago

Build tool

Vite

Where do you see the problem?

Describe the bug

Originally posted by @mp3por in https://github.com/crxjs/chrome-extension-tools/issues/892#issuecomment-2203007906

> > I was not able to get the HMR working. When I change my code to look like yours however I get the following issue. This screen keeps flickering. I don't understand enough to debug further. > > image My response: > try it one more time. This is an issue i also have sometimes when swiching branches - restarting the dev server several times helps (and if not remove .vite or node_modules, npm install and run again). It is independent from HMR but something with a server startup.

This is an issue i experience sometimes when swiching branches - restarting the dev server several times helps (and if not remove .vite or node_modules, npm install and run again)

image

Reproduction

  1. Have a project with popup in react
  2. Switch branch when vite dev is opened
  3. The popup will go into 'vite dev mode' forever
  4. Kill the dev server
  5. Start it again
  6. Nothing changes
  7. Try again and again and eventually it will load

I need more people to report it so that we can have a proper repro. For me its when i switch branches but im not sure what is the solution. Sometimes i delete node_modules and .vite folders but its not 100% guaranteed to fix the issue

image

Logs

Just 404s from the dev server.
The popup devtools just gets HTTP 404 in a infinity loop

System Info

System:
    OS: Windows 11 10.0.22631
    CPU: (20) x64 12th Gen Intel(R) Core(TM) i7-12700H
    Memory: 5.44 GB / 31.70 GB
  Binaries:
    Node: 20.12.2 - C:\Program Files\nodejs\node.EXE
    npm: 10.5.0 - C:\Program Files\nodejs\npm.CMD
    pnpm: 9.3.0 - C:\ProgramData\chocolatey\bin\pnpm.EXE
  Browsers:
    Edge: Chromium (126.0.2592.87)
    Internet Explorer: 11.0.22621.3527
  npmPackages:
    @crxjs/vite-plugin: ^2.0.0-beta.23 => 2.0.0-beta.23 
    vite: ^5.2.11 => 5.2.11

Severity

annoyance

matyas-gubis commented 1 month ago

I had the same issue, and I was also jumping between branches. I could not yet find it, and at the moment of reading your comment, I have no access to my dev setup. Will try further soon