Failed to dynamically inject content script using activeTab

I want to inject content script using activeTab permissions through my background script. When I am referring the file like this import contentFile from "url:./lib/content.tsx" and executing it like this

await chrome.scripting.executeScript({
target: { tabId: activeTab.id },
files: [contentFile],
});

await chrome.scripting.executeScript({
target: { tabId: activeTab.id },
files: [contentFile],
});
I get the error
Failed to inject content script into tab 1745686768: Could not load file: 'chrome-extension://pgjafffjephfjkddakgkhnlooeclcjfb/static/background/../../content.3c0df212.js'. Error: Could not load file: 'chrome-extension://pgjafffjephfjkddakgkhnlooeclcjfb/static/background/../../content.3c0df212.js'.
I @ index.js:1
await in I
(anonymous) @ index.js:1
Failed to inject content script into tab 1745686768: Could not load file: 'chrome-extension://pgjafffjephfjkddakgkhnlooeclcjfb/static/background/../../content.3c0df212.js'. Error: Could not load file: 'chrome-extension://pgjafffjephfjkddakgkhnlooeclcjfb/static/background/../../content.3c0df212.js'.
I @ index.js:1
await in I
(anonymous) @ index.js:1
but I am able to navigate to the url and open it in the tab like this (attached image) I have also attached the manifest.
No description
No description
No description
0 Replies
No replies yetBe the first to reply to this messageJoin

Did you find this page helpful?