Re:Show HN: I made a CLI tool to create web extensions with ...
by cezaraugustodev on Wednesday May 01, 2024 @07:48AM
(#40221980)
That's interesting, what do you mean? An abstraction for the manifest apply dev defaults or instructions on how each major part should work?
[ Parent
| on HN ]
Re:Show HN: I made a CLI tool to create web extensions with ...
by dotproto on Wednesday May 01, 2024 @11:28AM
(#40224653)
I don't know exactly what the the person you're replying to had in mind, but support for different parts of the manifest varies (especially in Manifest V3). While it's possible to write a single manifest that works in all browsers (with warnings), doing so requires more than a little specialized knowledge.
For example, Firefox does not currently support the `optional_host_permissions` top level manifest key. To work around this, developers can declare their optional host permissions in both the `optional_host_permissions` array for Chrome compatibility and in the `optional_permissions` array for Firefox/Safari compatibility.
Another example is that currently only Chrome supports `background.service_worker` in stable releases. To work around this, developers can write their MV3 background scripts in a way that's compatible with both service workers and event pages, then declare both in the manifest like so:
```json { "background": { "scripts": ["background.js"], "service_worker: "background.js" } } ```
Re:Show HN: I made a CLI tool to create web extensions with ...
by Vinnl on Friday May 03, 2024 @07:37AM
(#40246491)
Yep, that's it! I settled for generating the manifest.json through a script, since at some point adding something only supported by one browser would cause an error in the other, though I think that may have been remedied now.