wxt
wxt copied to clipboard
Content script is incorrectly invalidated when injected multiple times
Describe the bug
When a content script is injected multiple times, all but the most recent one should be invalidated. In practice however, all content scripts, including the most recent one, are invalidated.
Video going over the issue, the root cause, and the fix: https://www.loom.com/share/97983e5d38904af594d5f486bbf9f1f4?sid=e588c652-c868-4cb0-8db2-521650726919
Reproduction
Minimal reproduction: https://github.com/namukang/wxt-invalidation-bug
Steps to reproduce
Steps to reproduce:
- Clone https://github.com/namukang/wxt-invalidation-bug
- Run
wxt dev - Navigate to http://example.com
- Open the console
- Click the extension icon
Expected behavior
Only the first content script is invalidated.
Actual behavior
Both content scripts are invalidated.
System Info
System:
OS: macOS 15.6.1
CPU: (10) arm64 Apple M1 Max
Memory: 3.33 GB / 64.00 GB
Shell: 5.9 - /bin/zsh
Binaries:
Node: 22.12.0 - /Users/dk/.nvm/versions/node/v22.12.0/bin/node
npm: 10.9.0 - /Users/dk/.nvm/versions/node/v22.12.0/bin/npm
pnpm: 10.6.1 - /Users/dk/.nvm/versions/node/v22.12.0/bin/pnpm
bun: 1.2.23 - /opt/homebrew/bin/bun
Deno: 2.5.3 - /opt/homebrew/bin/deno
Browsers:
Brave Browser: 100.1.37.109
Chrome: 141.0.7390.107
Edge: 141.0.3537.71
Firefox: 133.0.3
Safari: 18.6
npmPackages:
wxt: ^0.20.11 => 0.20.11
Used Package Manager
pnpm
Validations
- [x] Read the Contributing Guidelines.
- [x] Read the docs.
- [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 open a GitHub Discussion or join our Discord Chat Server.
- [x] The provided reproduction is a minimal reproducible example of the bug.