Running browser extensions through minifiers is pretty representative of the absurdity of the NodeJS/NPM cargo cult.<p>No one who's writing an open source browser extension should be using minification, and no one who's installing a browser extension should be installing one that's closed source. Previously:<p>> <i>Most people aren't (or at least feel they aren't) able to take a hardline stance about only using free software, but if there's one area of your digital life you should be able to apply it to, it's browser extensions.</i><p><<a href="https://news.ycombinator.com/item?id=41998764">https://news.ycombinator.com/item?id=41998764</a>>
Buult a small extension recently, and spent a while trying crxjs and some various rollup plugins and other options.<p>It was taking a long long time, and I didn't have many dependencies I needed. So I just wrote the code by hand, unbundled. Using esm wasn't too too hard, but you have to use dynamic imports & a chrome specific getURL. <a href="https://stackoverflow.com/a/53033388" rel="nofollow">https://stackoverflow.com/a/53033388</a>
For those who have worked a lot with web extensions, I’m curious to hear what their experiences are with frameworks. There are quite a few that I’ve come across:<p>- WXT<p>- Plasmo: www.plasmo.com<p>- CRXJS: <a href="https://crxjs.dev/vite-plugin" rel="nofollow">https://crxjs.dev/vite-plugin</a><p>- Web Extension Vite Starter: <a href="https://github.com/antfu-collective/vitesse-webext" rel="nofollow">https://github.com/antfu-collective/vitesse-webext</a><p>- Bedframe: <a href="https://github.com/nyaggah/bedframe" rel="nofollow">https://github.com/nyaggah/bedframe</a><p>to name a few. Has anyone used multiple of these? If so, how do they compare? What makes one stand out above the others?
I decided to try this recently on my first browser extension and so far the experience has been good.<p>Sometimes the websocket connection for the hot reload dies but apart from that I've been quite impressed.<p>Just abstracting away the different manifest files and using the webextension polyfill is all I need and it works.<p>The only shame is how abysmal the experience is in Firefox I find myself preferring to debug the extension in Chrome as getting to the debugger in Firefox is such a pain. And I use Firefox as my primary browser so it's not because of a Chrome bias I say this. The Firefox folks could really improve the UX here.