vitesse-webext icon indicating copy to clipboard operation
vitesse-webext copied to clipboard

refactor/mv3 contentScript HMR is not work

Open xlzy520 opened this issue 2 years ago • 8 comments

Describe the bug

code

image

page

image

if refresh the ext image

page is ok. image

Reproduction

vitesse-webext/src/contentScripts/index.ts

System Info

System:
    OS: macOS 11.7.1
    CPU: (8) arm64 Apple M1
    Memory: 96.77 MB / 16.00 GB
    Shell: 5.8 - /bin/zsh
  Binaries:
    Node: 16.14.0 - /usr/local/bin/node
    Yarn: 1.22.5 - ~/.yarn/bin/yarn
    npm: 8.3.1 - /usr/local/bin/npm
  Browsers:
    Chrome: 108.0.5359.124
    Edge: 103.0.1264.71
    Firefox: 106.0
    Safari: 14.1.2

Used Package Manager

pnpm

Validations

  • [X] Follow our Code of Conduct
  • [X] Read the Contributing Guide.
  • [X] Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
  • [X] Check that this is a concrete bug. For Q&A, please open a GitHub Discussion instead.
  • [X] The provided reproduction is a minimal reproducible of the bug.

xlzy520 avatar Jan 11 '23 10:01 xlzy520

SAME, and my solution was to install the Extensions Reloader. After making changes to the extension files, I would on click the Extensions Reloader button and refresh the page to ensure the changes would be applied.

hakadao avatar Mar 28 '23 03:03 hakadao

@xlzy520 Has the problem been resolved now? I also encountered the same problem.

zf1998 avatar May 21 '23 15:05 zf1998

refactor/mv3 is deprecated, please use main branch

tmkx avatar May 22 '23 03:05 tmkx

@tmkx as far as I can tell, HMR ins't working for content script on the main branch :-/

louisremi avatar May 23 '23 12:05 louisremi

I think it's hard to make HMR working for contentScript? for example, the script is injected to a webpage(.e.g https://example.com),when we try to connect with vite server(protocol http), it should meet a "mixed content" error

tmkx avatar May 23 '23 14:05 tmkx

@tmkx But plasmo did it.

tshemeng avatar Aug 04 '23 06:08 tshemeng

@tmkx as far as I can tell, HMR ins't working for content script on the main branch :-/

It is still not work for now.

yunsii avatar Sep 04 '23 12:09 yunsii

@tmkx But plasmo did it.

After I tested, plasmo seems not supported content scripts TRUE HMR, related code: consolidateUpdate(), it reload page roughly, but chrome-extension-tools supported.

ref: https://github.com/PlasmoHQ/plasmo/issues/755

yunsii avatar Sep 06 '23 14:09 yunsii