Skip to content
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

Firefox support discussion (MV2, MV3) #78

Open
fregante opened this issue May 12, 2022 · 15 comments · May be fixed by #97
Open

Firefox support discussion (MV2, MV3) #78

fregante opened this issue May 12, 2022 · 15 comments · May be fixed by #97
Labels
documentation Improvements or additions to documentation firefox help wanted Extra attention is needed

Comments

@fregante
Copy link
Owner

fregante commented May 12, 2022

Firefox doesn't yet support Manifest v3 background workers (update March 2023)_ but this build works exclusively on that. You can use this issue to discuss alternative methods of supporting both Firefox and Chrome.

Refer to these links for official MV3 support in Firefox:

@fregante fregante added documentation Improvements or additions to documentation question Further information is requested firefox labels May 12, 2022
@fregante
Copy link
Owner Author

The one that makes the most sense so far is a solution originally posted by @Stvad in #75 (comment)

@fregante
Copy link
Owner Author

fregante commented May 12, 2022

Alternatively, the extension can be changed to use Manifest v2 after the build runs, originally posted in #55 (comment)

  1. Run npm run build
  2. In the distribution/manifest.json file, revert the same changes you see in #75:
  • set manifest_version to 2
  • move host_permissions items back to permissions
  • restore the previous background key
  1. Save that version just for Firefox

@psiinon
Copy link

psiinon commented May 23, 2022

Would have liked to use this repo but the lack of Firefox support is a blocker for me.
I wouldnt have minded how it was supported but manually editing files just seems too fragile to me - it indicates that Firefox support is not a priority and so I'd expect such hacks to break at short notice :(

@aspiers

This comment was marked as off-topic.

@Stvad

This comment was marked as resolved.

@milangress
Copy link

@fregante I believe that since January 17, 2023 (FF 109) V3 Manifests are supported, right?

Do you think it makes sense to reintroduce the polyfill? #88

@fregante
Copy link
Owner Author

fregante commented Mar 22, 2023

I believe that since January 17, 2023 (FF 109) V3 Manifests are supported, right?

  1. Firefox still does not support background workers: https://bugzilla.mozilla.org/show_bug.cgi?id=1573659
  2. Chrome refuses to load a manifest that specifies both backgrounds scripts and workers.
  3. Parcel doesn't recognize background scripts in MV3 yet (edit: fixed)

These issues mean that there's still no way to build a cross-browser extension with a single manifest.json.

Do you think it makes sense to reintroduce the polyfill? #88

The polyfill is no longer needed because Chrome also has promisified APIs in MV3. You can just use chrome.* APIs in every browser.

@f-person

This comment was marked as resolved.

@fregante

This comment was marked as resolved.

@fregante
Copy link
Owner Author

By the way, Firefox now accepts MV3 extensions, with the exception that background workers are not supported (background scripts are).

I think that Parcel 2.9 supports setting both background.worker and background.script in the manifest, but Chrome will reject such manifest.

In short, you can now build cross-browser MV3 extensions:

  • set both background.worker and background.script in your manifest
  • remove background.script before opening the extension in Chrome.

@f-person

This comment was marked as resolved.

@fregante
Copy link
Owner Author

fregante commented Dec 10, 2023

Maybe we're close here. It seems that Chrome 121 will finally allow background.scripts in its manifest (just allow, not use):

This means that it will finally be possible restore Firefox support by this template:

  • Add a background script for Firefox
  • Restore all mentions to Firefox support in the docs and deployment

Schedule for Chrome 121:

Tue, Jan 23, 2024

@aspiers
Copy link

aspiers commented Jan 31, 2024

I note that https://github.com/Jonghakseo/chrome-extension-boilerplate-react-vite/ (which is another extension template) takes a slightly different approach of specifying the manifest in manifest.js and then automatically generating manifest.json from that, in the process converting it to be Firefox-capable when building for Firefox.

Is it worth considering a similar approach here, or are we close enough to being able to craft a single manifest.json which works with both that it's not worth changing course now?

@fregante
Copy link
Owner Author

Given that Chrome 121 is out, this should already work out of the box, just specify background.scripts and make sure you're using the latest parcel version

@fregante fregante added help wanted Extra attention is needed firefox and removed firefox question Further information is requested labels Jan 31, 2024
@fregante
Copy link
Owner Author

fregante commented Feb 1, 2024

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation firefox help wanted Extra attention is needed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants