Skip to content

Support for devtools panel #574

Answered by gpichot
gpichot asked this question in Q&A
Nov 6, 2022 · 1 comments · 1 reply
Discussion options

You must be logged in to vote

Okay so for anyone looking for an answer: it does not look like you can import a javascript file from a panel. In place you can add a listener to panel.onShow to retrieve the window instance :

chrome.devtools.panels.create(
  "My Panel",
  "icon.png",
  "/src/panel.html",
  (panel) => {
    panel.onShown.addListener((window) => {
      window.document.body.innerHTML = "Hello World";
    });
  }
);

EDIT: styles (from either imported *.module.scss, *.css files, or from styled-components and CSS-in-JS libraries) will not work by default. Styles are injected in the devtools.html document and not in the panel.html document to make it work both in development and production it will require :

  • t…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@JustinGrote
Comment options

Answer selected by gpichot
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants