aklinker1 / vite-plugin-web-extension

Vite plugin for developing Chrome/Web Extensions
https://vite-plugin-web-extension.aklinker1.io/
MIT License
653 stars 58 forks source link

feat: Don't transform entrypoints prefixed with `public:` #170

Closed aklinker1 closed 11 months ago

aklinker1 commented 11 months ago

This closes #167. If you add public: in front of an entrypoint in your manifest, the plugin will render it to the final manifest without processing the file.

For example, if you want to load jquery into a content script, and have downloaded a version locally:

public/
  vendor/
    jquery.min.js
src/
  my/
    content-script.ts
{
  // ...
  "content_scripts": [
    {
      "matches": [...],
      "js": ["public:vendor/jquery.min.js", "src/my/content-script.ts"],
    }
  ]
}

If possible, I would recommend just using the NPM modules, but sometimes it's easier to just keep using a version from a CDN.