Error when reloading dynamically registered content script
Nobody has claimed this yet.
- 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.
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.
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
- Read the Contributing Guidelines.
- Read the docs.
- Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
- Check that this is a concrete bug. For Q&A open a GitHub Discussion or join our Discord Chat Server.
- The provided reproduction is a minimal reproducible example of the bug.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- 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