PlasmoHQ / plasmo

🧩 The Browser Extension Framework
https://www.plasmo.com
MIT License
10.32k stars 358 forks source link

[RFC] Manifest override by special target #952

Open monkeyWie opened 5 months ago

monkeyWie commented 5 months ago

How do you envision this feature/change to look/work like?

Add manifest_specific configuration to support override the manifest for specific browser targets.

What is the purpose of this change/feature? Why?

For example: my extension needs to declare the webRequestBlocking permission in firefox, but not in chrome, because declaring it in chrome mv3 results in the error

(OPTIONAL) Example implementations

Configuration example:

{
  "manifest": {
    "host_permissions": [
      "http://*/*",
      "https://*/*"
    ],
    "permissions": [
      "downloads",
      "cookies"
    ]
  },
  "manifest_specific":{
    "firefox-mv2": {
      "permissions": [
        "downloads",
        "cookies",
        "webRequest",
        "webRequestBlocking"
      ]
    }
  }
}

Finally firefox-mv2 Firefox get the merged manifest.json:

{
    "host_permissions": [
      "http://*/*",
      "https://*/*"
    ],
    "permissions": [
      "downloads",
      "cookies",
      "webRequest",
      "webRequestBlocking"
    ]
  }

(OPTIONAL) Contribution

Verify canary release

Code of Conduct

zepedr0 commented 4 months ago

Same issue for me. I want to declare the sidebar_action key which works for firefox but throws an error in chrome:

Screenshot 2024-05-21 at 15 14 52