Skip to content

fix: support mv3 background script #222

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Closed
wants to merge 1 commit into from

Conversation

iantanwx
Copy link

Fixes background worker issues in manifest version 3. See rubenspgcavalcante/webpack-extension-reloader#139.

Checklist

  • I ran the linting and formatting tools (ESLint and Prettier)
  • I added addittional tests if adding new features

Closes #[ISSUE_NUMBER]

@ralphschindler
Copy link

Hi! Any movement on getting this PR in master? Thanks :D

@bashbaugh
Copy link

Hey! I'm looking for this as well, can it be merged?

@lucasrmendonca
Copy link
Contributor

Hi @rushilsrivastava @rubenspgcavalcante could you help to review this PR?

@just-jeb
Copy link

just-jeb commented Jun 30, 2022

I've tried both this patch and #220, none of them seem to be working. Getting Service worked registration failed with Uncaught TypeError: Cannot read properties of null (reading 'runtime') because browser is null.

@iantanwx
Copy link
Author

iantanwx commented Jul 6, 2022

I've tried both this patch and #220, none of them seem to be working. Getting Service worked registration failed with Uncaught TypeError: Cannot read properties of null (reading 'runtime') because browser is null.

that's really odd -- it works in our fork. could you try that and see?

@rushilsrivastava
Copy link
Member

Sorry for the hiatus - happy to help get this merged in.

I've tried both this patch and #220, none of them seem to be working. Getting Service worked registration failed with Uncaught TypeError: Cannot read properties of null (reading 'runtime') because browser is null.

Any reproducible examples?

@just-jeb
Copy link

just-jeb commented Jul 7, 2022

@iantanwx @rushilsrivastava are your forks up to date with master? What I did essentially is taking these patches and applying them on a latest local version of webpack-ext-reloader.
There is an example here, in order to get the error you'll have to use your patched version of webpack-ext-reloader and uncomment the plugin usage in dev config.
After that just run yarn watch.

@rushilsrivastava
Copy link
Member

@iantanwx Were you able to reproduce this?

@iantanwx
Copy link
Author

iantanwx commented Aug 14, 2022

@rushilsrivastava Sorry I have been really busy, have not rebased upstream yet. Will try to do this in the coming week. Apologies!

@lucasrmendonca
Copy link
Contributor

Hi @iantanwx any news on this?

@sherifmayika
Copy link

sherifmayika commented Nov 27, 2022

I've tried both this patch and #220, none of them seem to be working. Getting Service worked registration failed with Uncaught TypeError: Cannot read properties of null (reading 'runtime') because browser is null.

I can give you a clue to how to solve this issue. browser.runtime should be replaced with chrome.runtime in manifest 3.
for example: open: webpack-ext-reloader.js from '/node_modules/webpack-ext-reloader/dist' replace "browser.extension", "browser.runtime", with "chrome.extension" and "chrome.runtime" . Origin of this error is from 'webextension-polyfill'. I think 'webextension-polyfill' lack support for manifest 3.

it is better to remove 'webextension-polyfill'
https://stackoverflow.com/questions/68488195/browser-extension-manifest-v3-with-webextension-polyfill-does-not-allow-browser

reorx added a commit to reorx/webpack-ext-reloader that referenced this pull request Feb 23, 2023
This fixes `browser` is undefined which should be caused by
webextension-polyfill's bad support for MV3

see: SimplifyJobs#222
@reorx
Copy link

reorx commented Feb 23, 2023

I adapted @sherifmayika 's advice and finally made my fork work. Anyone with the same problem can try to use my fork at https://github.com/reorx/webpack-ext-reloader

@rushilsrivastava
Copy link
Member

Perfect, I'll take a look at the PR @reorx!

@vialoh
Copy link
Collaborator

vialoh commented Sep 28, 2023

Closing in favor of #386.

@vialoh vialoh closed this Sep 28, 2023
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants