StarkShang / vite-plugin-chrome-extension

A vite plugin to bundle chrome extensions for Manifest V3.
MIT License
467 stars 68 forks source link

Add support for DevTools #16

Open steinybot opened 3 years ago

steinybot commented 3 years ago

It would be nice if it was also able to find assets used when creating DevTools such as:

chrome.devtools.panels.create("Font Picker",
                              "FontPicker.png",
                              "Panel.html",
                              function(panel) { ... });

and

chrome.devtools.panels.elements.createSidebarPane("Font Properties",
  function(sidebar) {
    sidebar.setPage("Sidebar.html");
    sidebar.setHeight("8ex");
  }
);

See https://developer.chrome.com/docs/extensions/reference/devtools_panels/#method-ExtensionSidebarPane-setPage

steinybot commented 3 years ago

As a workaround I figured out I could put this in vite.config.ts:

  build: {
    rollupOptions: {
      input: {
        manifest: "src/manifest.json",
        panel: "src/panel.html"
      }
    }
  }