diff --git a/docs/guide/essentials/content-scripts.md b/docs/guide/essentials/content-scripts.md index e8b350d9..584c90eb 100644 --- a/docs/guide/essentials/content-scripts.md +++ b/docs/guide/essentials/content-scripts.md @@ -548,16 +548,21 @@ To use `injectScript`, we need two entrypoints, one content script and one unlis ```ts // entrypoints/example-main-world.ts export default defineUnlistedScript(() => { - console.log('Hello from the main world!'); + console.log('Hello from the main world'); }); ``` ```ts // entrypoints/example.content.ts -export default defineContentScript(async () => { - await injectScript('/example-main-world.js', { - keepInDom: true, - }); +export default defineContentScript({ + matches: ['*://*/*'], + async main() { + console.log('Injecting script...'); + await injectScript('/example-main-world.js', { + keepInDom: true, + }); + console.log('Done!'); + }, }); ```