Content script not executing

Hello everyone, I was going though the docs and the getting started section. I'm trying to load a content-script as on this page https://docs.plasmo.com/framework/content-scripts and https://github.com/PlasmoHQ/examples/blob/main/with-content-script/content.ts However, when I visit https://www.plasmo.com the script does appear to load/execute for some reason. I'm on firefox, and I've attached my folder structure, the content script and the console from dev tools.
import type { PlasmoCSConfig } from "plasmo"

export const config: PlasmoCSConfig = {
matches: ["https://www.plasmo.com/*"]
}

window.addEventListener("load", () => {
console.log(
"You may find that having is not so pleasing a thing as wanting. This is not logical, but it is often true."
)

document.body.style.background = "pink"
})
import type { PlasmoCSConfig } from "plasmo"

export const config: PlasmoCSConfig = {
matches: ["https://www.plasmo.com/*"]
}

window.addEventListener("load", () => {
console.log(
"You may find that having is not so pleasing a thing as wanting. This is not logical, but it is often true."
)

document.body.style.background = "pink"
})
Plasmo Docs
Content Scripts – Plasmo
How to use Plasmo content scripts to inject custom behavior into web pages
GitHub
examples/with-content-script/content.ts at main · PlasmoHQ/examples
🔰 Example projects that demonstrate how to use the Plasmo Framework and integrate with popular tools - PlasmoHQ/examples
Plasmo
Supercharge your browser extension development
Plasmo is a browser extension development platform that helps you build, publish, and manage your browser extensions.
From An unknown user
From An unknown user
From An unknown user
No description
No description
2 Replies
filthytone
filthytone•8mo ago
why are you listening for a load event? by default content scripts will inject when document_idle which could be before OR after the load event .. so just run your code without the event handler if there's some explicit reason you have to wait for load event, you can, but when the script runs you can also check for document.readyState == 'complete' and bypass the event handler
DentFuse
DentFuse•8mo ago
This was what was in the docs, I just copied it Also using the debugger I figured out that the event actually does fire, however the console.log never executes and the script script stops execution after console.log is called
Want results from more Discord servers?
Add your server