Cuando envío un mensaje desde el contenido al fondo, recibo este error en el registro del script de contenido (registro de la consola de Chrome):
Uncaught (in promise) Error: Could not establish connection. Receiving end does not exist.En el registro del trabajador del servicio, no se registra nada cuando envío un mensaje desde el contenido. A continuación se encuentran mi backgroundScript, contentScript y mi manifest.json. Estoy usando manifiesto v3.
fondoScript.js
chrome.runtime.onMessage.addListener(function (request, sender, sendResponse) { console.log('request: ', request); });contentScript.js
chrome.runtime.sendMessage({ greeting: 'hello' });manifiesto.json
{ "manifest_version": 3, "name": "Chrome Extension with React & Webpack", "description": "A chrome extension boilerplate built with React 17, Webpack 5, and Webpack Dev Server 4", "options_page": "options.html", "background": { "service_worker": "background.bundle.js" }, "action": { "default_popup": "popup.html", "default_icon": "icon-34.png" }, "chrome_url_overrides": { "newtab": "newtab.html" }, "icons": { "128": "icon-128.png" }, "content_scripts": [ { "matches": ["http://*/*", "https://*/*", "<all_urls>"], "js": ["contentScript.bundle.js"], "css": ["content.styles.css"] } ], "host_permissions": ["http://*/"], "devtools_page": "devtools.html", "web_accessible_resources": [ { "resources": ["content.styles.css", "icon-128.png", "icon-34.png"], "matches": [] } ] }