JohnBra / vite-web-extension

Vite web extension template. Setup with React, Typescript and TailwindCSS
MIT License
504 stars 79 forks source link

How to specify Web Accessible Script in `web_accessible_resources`? #28

Closed skube closed 7 months ago

skube commented 7 months ago

My use-case requires a script to be web accessible. This is neither a content script nor a background script. Normally, I would simply list the script in the manifest.json:

  "web_accessible_resources": [
    {
      "resources": ["some-accessible-script.js"],

How does one accomplish this with this boilerplate?

JohnBra commented 7 months ago

Hi @skube, I think what you are looking for is the scripting API.

The boilerplate is just a convenience thing to enable react + tailwind and generate your JS files + manifest. It shouldn't be any different from your standard way of implementing a Chrome Extension.

skube commented 7 months ago

Thanks @JohnBra. I guess I'm a little confused how to generate the some-accessible-script.js from a .ts file? Or I just create the .js "outside" of the boilerplate system?