wxt-dev / wxt-dev/wxt

Error when reloading dynamically registered content script

Open
#1,674 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

pending-triage
Dominant language
TypeScript
Stars
10.5k
Forks
564
PR merge metrics
No merged PRs in 30d

Description

Describe the bug

An error occurs in development when reloading a dynamically registered content script.

Image

It can be worked around by including the matches property in the content script entrypoint (see the included reproduction code).

I'd be happy to do a PR if a solution is agreed.

Reproduction

wxt-content-script-reload-bug.zip

Steps to reproduce

Launch the provided project and look at the service worker logs. Editing the content script in dev causes the error to appear again in the service worker.

Image
System Info
System:
    OS: macOS 15.4.1
    CPU: (10) arm64 Apple M1 Max
    Memory: 254.25 MB / 64.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 22.14.0 - ~/.nodenv/versions/22/bin/node
    Yarn: 1.22.22 - ~/.nodenv/versions/22/bin/yarn
    npm: 11.2.0 - ~/.nodenv/versions/22/bin/npm
    pnpm: 10.11.0 - ~/.nodenv/versions/22/bin/pnpm
  Browsers:
    Brave Browser: 135.1.77.100
    Chrome: 136.0.7103.114
    Chrome Canary: 138.0.7181.0
    Edge: 136.0.3240.76
    Safari: 18.4
    Safari Technology Preview: 18.4
  npmPackages:
    wxt: ^0.20.6 => 0.20.6
Used Package Manager

pnpm

Validations

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Launch the attached wxt-content-script-reload-bug.zip reproduction with pnpm and inspect the service worker logs while editing the dynamically registered content script. Trace the development reload path and use the reproduction steps to verify that reloading no longer produces the reported error without requiring matches in the entrypoint.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
build-system, devtools
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.