Skip to content

Chrome: Background scripting error "Could not load javascript 'src/pages/content/index.tsx' for script." #146

@khoathanglong

Description

@khoathanglong

I wrote below code in src/pages/background/index.ts trying to get content_script

  chrome.scripting.registerContentScripts([
    {
      js: ["src/pages/content/index.tsx"],
      matches: ["*://*/*", "<all_urls>"],
      runAt: "document_idle",
      id: "session-script",
    },
  ])
  .then(() => console.log("registration complete"))
  .catch((err) => console.warn("unexpected error", err));

This is the error I got when inspecting service_worker

Image

Do you know how to resolve it? My purpose is to have content_script to access window object of the active page.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions