You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've noticed that ContentScriptContext would get invalidated prematurely and therefore restrict any further use of wxt APIs. Initially I thought I missed some configuration with wxt but the minimal reproduction I've described below indicates that there might be a bug with wxt itself.
Reproduction
Either use the attached archive or follow the steps below:
Initialize a vanilla extension via pnpm dlx wxt@latest init
Sometimes this script will work be sometimes not. But the event listener without ctx will always work.
exportdefaultdefineContentScript({matches: ["<all_urls>"],main(ctx){console.log("Content script loaded",ctx.isValid);setInterval(()=>console.log("Content script is alive",ctx.isValid),1000);window.addEventListener("keydown",(e)=>console.log("works without ctx",e.key));ctx.addEventListener(window,"keydown",(e)=>console.log("doesn't work with ctx",e.key));},});
Describe the bug
I've noticed that
ContentScriptContext
would get invalidated prematurely and therefore restrict any further use of wxt APIs. Initially I thought I missed some configuration with wxt but the minimal reproduction I've described below indicates that there might be a bug with wxt itself.Reproduction
Either use the attached archive or follow the steps below:
pnpm dlx wxt@latest init
ctx
will always work.Reproduction archive: test.zip
Steps to reproduce
No response
System Info
Used Package Manager
pnpm
Validations
The text was updated successfully, but these errors were encountered: