How do you avoid repeating code for, say, both a Firefox and Chrome extension? Chrome recently mandated that only manifest V3 extensions can be submit to their online store, and that introduces quite the number of breaking changes from V2 (even with the polyfill package). As far as I can tell, Firefox does not yet support V3 (I could be quite mistaken there).
As someone new to writing extensions and trying to write something for at least both Firefox and Chrome, how should I go about it? Or do I have to accept writing separate background.js files, separate manifest.json files, etc.?
Could anyone suggest a good resources/guides/tutorials/books for writing Firefox add-ons?
I remember making a cursory search a year ago, and hardly found anything remarkable. (Might have been a case of Google's-bad-search-results syndrome.)