- HMR (hot module replacement) when module updates are safe
- Classified reloads (full, service worker, content scripts, or notify-only page) when runtime assets change
- Restart required errors/warnings when entrypoint structure changes
Reload prerequisites (devtools setup dialog)
Before evaluating reload behavior, confirm the same setup checks shown in the Extension.js devtools Confirm setup dialog:
If you skip either step, reload behavior can appear inconsistent even when the build pipeline is healthy.
Reload tiers
1) Hot module replacement (fastest path)
Extension.js uses HMR when code can update without restarting the extension’s background processes and event listeners. Common examples:- Scripts attached to extension HTML pages (accept updates through injected HMR wrappers)
- Background script modules in non-service-worker flows
- Scripts registered via the
userScriptsAPI - CSS updates in content-script/runtime wrappers where supported
2) Classified reloads
When a change needs more than HMR, Extension.js classifies it into one of four reload kinds:
The decision comes from the compiler’s chunk graph, not from filenames, and follows a fixed order:
- Forced full. A change to
manifest.jsonor anything under_locales/always classifies asfull, no matter what else changed. - Chunk membership. Extension.js looks up which chunks contain each changed source. A source in a
background/chunk meansservice-worker. A source in acontent_scripts/chunk meanscontent-scripts. - Changed static asset. Some changed files exist in the output directory but belong to no chunk: an icon, a web-accessible resource, a DNR ruleset. These force
full, so the browser re-reads them from disk. - Name heuristics. Only for sources the chunk graph does not know: paths matching
backgroundorservice workerpatterns classify asservice-worker. - Content fallback. If the manifest declares content scripts, remaining unknown changes re-inject every content-script entry.
- Notify-only page. Everything else is a
pageinstruction: livereload owns the refresh, and the reload announcement still fires.
context (fileA, fileB +2 more), for example service_worker + content_script (shared/api.ts). The same label appears verbatim in CLI stdout, in the page devtools console, and in the devtools pill, so you can correlate a reload across all three without guessing.
If the browser serves a stale cached service worker after a reload, the dev server detects the version mismatch and resynchronizes the extension automatically. You should not need to manually remove and re-add the extension to recover.
Why do content script filenames include hashes in dev? Chrome aggressively cacheschrome-extension://resources. A stable filename likecontent-0.jscan serve stale code even after a full extension reload. Extension.js appends a short build hash in development (for example,content-0.abcd1234.js). Each rebuild produces a fresh URL that bypasses the cache. Production builds use clean names. SethashContentScripts: falseinextension.config.*to opt out and keep stable dev filenames.
3) Restart required (dev server)
When extension entrypoint references change (not just module contents), Extension.js reports restart-required diagnostics. This prevents you from continuing with a stale dependency graph. Typical restart-required scenarios:- Manifest script entrypoint list changes
- HTML entrypoint script/style references change
pages//scripts/file set changes in watch mode (especially removals)
Behavior matrix
How the dev runtime gets injected
The reload plugin instruments your build in five injection steps, then prunes:- Strip the dev-server runtime from content-script chunks, which cannot host it.
- Set up the reload strategy on the background and content-script entries.
- Inject the service-worker scripts-replay shim, so
/scripts/*injections re-run on edit. - Inject the bridge producer, so the background forwards console output to the control channel.
- Inject the bridge relay, so content-script console output reaches the same channel.
hot/. Hot-update chunks are fetched from disk on the extension origin, so stale generations would accumulate in what ships. Extension.js keeps the current generation plus one previous generation for in-flight fetches, and deletes the rest after every compile.
The whole pipeline is development-only. It is a no-op in production builds and when you pass --no-reload.
Reloading scripts and HTML outside the manifest
pages/ and scripts/ follow the same reload strategy as manifest-declared assets.
- Existing module updates can use hot-update paths.
- Entrypoint set changes (add/remove or reference graph changes) may require restart.
Extension.js recognizes the
/pages and /scripts folders for hot-reloading
and treats each entry as a separate page or script it can reload
independently.Scripts you inject programmatically with
chrome.scripting.executeScript from
/scripts/* are replayed on edit. When you change a file under
/scripts/, Extension.js re-runs the same injection on the same tab and tears
down the previous mount, so dynamically injected scripts update live, the way
declarative content_scripts do, instead of leaving stale DOM until you
manually re-trigger the call. This is a dev-only convenience.Best practices
- Keep entrypoint references stable during active dev sessions to maximize HMR.
- Batch
manifest.jsonand locale edits to avoid repeated hard extension reloads. - Use
pages/andscripts/for off-manifest assets, then restart when file sets or entry wiring changes. - Treat restart required diagnostics as intentional safety checks, not transient warnings.
Next steps
- Review off-manifest asset flows in Special folders.
- Understand structural update outcomes in Dev update behavior.

