crxjs / chrome-extension-tools

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

Hot module Reload triggers but does not apply for svelte CSS #816

Open Autumnlight02 opened 10 months ago

Autumnlight02 commented 10 months ago

Build tool

Rollup

Where do you see the problem?

Describe the bug

Hot Module Reload of Css seems to lag one reload behind, so you need to do an additional logical step to get the last stable "css" file out. It seems to be css focused for svelte.

Reproduction

Create a new svelte ts project by using https://github.com/guocaoyi/create-chrome-ext Create a App.svelte file in ContentScript In index.ts load the svelte file in. On the live page search that element and click on it with dev tools to see the css. Now change a style in a style element affecting that element. You will see that it laggs a reload behind, you need to restart the server to resolve it once. (Dev tools and console will show updates but the file they use for css is one iteration behind)

Logs

No response

System Info

System independent, had a friend test it on windows as well, as well testing bun. In create chrome ext i narrowed it down to ver create-chrome-ext-0.8.7 down where the upgrade from 1.0 to 2.0 happened

  System:
    OS: Linux 6.2 Fedora Linux 38.1.6 (Kinoite)
    CPU: (16) x64 AMD Ryzen 7 5700X 8-Core Processor
    Memory: 88.53 GB / 125.71 GB
    Container: Yes
    Shell: 5.2.15 - /bin/bash
  Binaries:
    Node: 20.8.0 - ~/.nvm/versions/node/v20.8.0/bin/node
    npm: 10.1.0 - ~/.nvm/versions/node/v20.8.0/bin/npm
  npmPackages:
    @crxjs/vite-plugin: ^1.0.12 => 2.0.0-beta.19 
    vite: ^2.9.13 => 4.5.0

Severity

[It borderline drove me insane, so much that i downgraded my entire project to use ver 1.0 of this dependency] annoyance

jbdxbl5 commented 3 months ago

相同的问题,不知道怎么解决