-
Notifications
You must be signed in to change notification settings - Fork 176
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support firefox / cross browser compatibility #56
Comments
A relevant comment by @avi12 from another issue, with an example repo:
|
The issue here is that Firefox doesn't support dynamic imports in web extensions, which we use to support Rollup's code splitting feature. What we need to do is bundle each content script and background script as an IIFE. This basically results in a mixed format build, which Rollup doesn't support natively. |
I tried importing functions using an import { someFunction } from "./some-script"; but it didn't work, despite not being a dynamic import (i.e. |
any development on this? I could really use it while developing ExtPay. |
@avi12 that's actually what I tried using but it's failing with a bunch of errors in firefox |
@Glench I used this boilerplate (minus TypeScript) in most of my cross-browser extensions (YouTube Auto HD + FPS, YouTube Like-Dislike Shortcut, Steam ID Finder, Twitch Channel Points Bonus Collector, Skillshare Player Control) |
@avi12 ooh my bad I was using a different svelte browser extension compiler. Thanks for the pointer! I don't know typescript but it doesn't look like that matters and maybe this will be a good excuse to learn it. By the way, if you're interested I made a service called ExtPay that lets you take payments directly inside your extensions without needing to run your own server. I made it for my own extensions but so far other people have found it useful. Feel free to contact me if you have questions! |
@Glench ExtPay sounds very good |
I'm curious, what's missing from the current state of the codebase? The README links to Here's the snippet and usage docs:
|
@hangtwenty The issue is that it makes the package size needlessly bigger |
Right, I forgot that last time I received an error |
This problem will not be a issue once Firefox 89 is released If there are any compatibility problems that occur, we will look into it once 89 hits the stable channel. |
Yeah but cool URIs don't change, and we should not expect repository or package names to communicate everything. (That's what READMEs are for) |
Re: package size, |
I'd say that depends on the complexity of the extension |
@avi12 Super helpful information, thank you! |
@hangtwenty The reason I said that the 2 biggest size impactors are the images and translations is that there's a limit point up to which you can reduce them {
"ext_name": {
"message": "Extension name"
},
"description": {
"message": "Description"
}
} The only optimizations here are to reduce the key names (which I wouldn't recommend doing since they have to match the places in the scripts where they're used) and minifying the JSON (can be done with Terser, as I said in my previous comment) |
@jacksteamdev how feasible is it to have an option to turn off code-splitting completely so we could support Firefox as of today? |
Firefox has added support for dynamic import in content scripts and now it may be relatively trivial to create Firefox compatible builds. There is still work to be done. Thanks @mnoorenberghe for getting the ball rolling with #75! Remaining known issues
PR's are welcomePlease note, I don't have the bandwidth to work on Firefox support right now 😞, but I'll be happy to merge PR's that add this feature! Tests are required for any new features, and a quick Loom of it working in Firefox will get your PR reviewed faster. If Firefox support is important to you, please contribute! 🙏 |
RPCE v4 is ready for testing, you can check out this guide to get started with React. I haven't tested it in Firefox, but I'd bet the new build works. If someone tries it, please comment. |
Since v4 only supports MV3 it can't currently work in Firefox. MV3 support in Firefox is in-progress. |
@mnoorenberghe True, that comment was before we dropped MV2 support for v4. Covering all the edge cases gets pretty complex! 😅 Hopefully Firefox releases MV3 support sooner than later! I'd like to offer some perspective for new extension projects. Currently Chrome, Edge, and Safari have MV3 support in stable or beta, which is ~85% of the desktop browsers out there. The Chrome Web Store doesn't accept new MV2 extensions, so any new extension that wants to support Firefox has to support both MV2 and MV3. That's a lot of work to gain about ~9% market share, especially when that extra work will be unnecessary in the near future. |
I'm using version 3.6 and manifest v2 content-scripts are working fine, and firefox recognizes the await browser.tabs.executeScript(tabId, {
code: `import(browser.runtime.getURL("./script.js")).then(x=>x.default())`
}); |
I have no idea if this is bad practice so open to feedback, but I'm tinkering with programmatic v2 and v3 manifests in my extension. Wanted to share in case someone else finds it helpful . I'm having a decent experience mimicking the In this case I use an empty string for the falsy value and The one issue I'm still working through is the only way I can get my extension to load in Firefox is by uploading the production zip file. |
Is manifest V2 going to be supported with new currently beta version of the plugin ? |
The Chrome Web Store no longer accepts new MV2 extensions, and Chrome won't even run MV2 starting in 2023 Q1. Considering that all the other browsers either support MV3 or have announced support by end of 2022, I'm not convinced that it's worth taking the development time away from other features and bug fixes. |
@jacksteamdev On Firefox's end, the browser doesn't support MV3 yet, so I'm curious to see whether the MV3 support will be added before Google officially terminates support for MV2 |
@avi12 Me too! |
https://www.mozilla.org/en-US/firefox/109.0/releasenotes/ supports manifest v3 as of Jan 17th 2023. |
any new updates on cross browser compatibility in crxjs? |
Firefox 109+ supports Manifest V3 |
Fixed by #776 |
Is your feature request related to a problem? Please describe.
No issue per-say but this rollup plugin would benefit people greatly if it worked in firefox as well.
Describe the solution you'd like
To be able to develop cross-browser extensions using only this plugin. There is a fork already for webextension-polyfill, which is the basis of cross-browser extension development
Describe alternatives you've considered
I've already done a rollup configuration that allows development of firefox plugins but only by importing every file separately. This would make it so much faster to create browser extensions
The text was updated successfully, but these errors were encountered: