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

How to use mv3 background service workers? #374

Closed
z0ccc opened this issue Mar 25, 2022 · 3 comments
Closed

How to use mv3 background service workers? #374

z0ccc opened this issue Mar 25, 2022 · 3 comments

Comments

@z0ccc
Copy link

z0ccc commented Mar 25, 2022

Hi,

The in mv2 background scripts are declared like this:

  "background": {
    "scripts": [
      "browser-polyfill.js",
      "background.js"
    ]
  },

But mv3 only allows a single service worker like this:

  "background": {
    "service_worker": "background.js"
  },

How would use both "browser-polyfill.js" and "background.js" as service workers in mv3?

Thanks

@Insiro
Copy link

Insiro commented Mar 26, 2022

in top of background.js
insert
importScripts("path/to/browser-polyfill.js");
i also trying mv3
but declarativeNetRequest not support yet...

@Rob--W
Copy link
Member

Rob--W commented Mar 31, 2022

Duplicate of #363. We should indeed document how importScripts can be used.

but declarativeNetRequest not support yet...

What do you mean by that? Even if DNR is not in the polyfill source, the polyfill will just forward the API access requests to the underlying APIs.

@Rob--W Rob--W closed this as completed Mar 31, 2022
@Insiro
Copy link

Insiro commented Mar 31, 2022

it just means I waiting for DNR support
I have a plan to use Dynamic to replace blocking on webRequest.onBeforeRequest
you mean.. there's another way to do like this??

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants