Skip to content

HMR/Watch with content-scripts that are injected via scripting #143

Answered by aklinker1
max-arias asked this question in Q&A
Discussion options

You must be logged in to vote

Edit: oh, you've disabled auto-launch. The response below assumes you're letting the plugin open the browser, which is what enables the automatic reloads on save, causing the runtime ID to be null, and thus making the hack work.

With auto-launch disabled, the plugin is unable to tell the extension to reload.


HMR won't work with content scripts since they are bundled into a single file in dev mode, just like they are in production. Also, content scripts don't support ES Modules, which HMR is built around.

There's a potential work around to the lack of ESM support, but it has downsides (like not being able to access the extension APIs, and ignoring a content scripts run_at option), so I h…

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@aklinker1
Comment options

@max-arias
Comment options

Answer selected by max-arias
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants