MV3 Support?
shuhankuang opened this issue ยท 38 comments
It will support MV3?
thanks.
At the moment, this will not work with MV3. However, we plan to release this functionality in the near future.
Any news guys?
The end of life of V2 reaching in a year and google started to slow down reviews of V2 starting this month....
@rushilsrivastava Do you need any help implementing the V3 Support?
Hey guys, thanks for being patient. Let me address a couple of things real quick:
The end of life of V2 reaching in a year and google started to slow down reviews of V2 starting this month....
Yup, MV2 end-of-life (no new updates will be allowed to existing MV2 extensions) is slated for January 2023. I predict that Google will probably end up delaying this, but nevertheless definitely pushes the need for V3 support. While I couldn't find any announcement for slow release of V2 extensions (anecdotally, all our reviews have been approved within 24-hours), as of January 2022, no new extensions with MV2 will be allowed. All this information can be found on Google's Support Page.
@rushilsrivastava Do you need any help implementing the V3 Support?
Here's my roadmap:
- Publish new version
v1.1.9
with latest bug fixes for Firefox and listeners. This will probably be the last release for1.x
granted there are no new bugs. - Start a new 2.x branch to start working on Manifest V3 changes. Once this is stable, this will become
master
.
As far as I know, there shouldn't be much work to get this to work in V3 other than reworking how background listeners work. I have no specific timeline to when I will be able to start work on V3, but if others are able to contribute PRs, I can commit to reviewing them and accelerating the roadmap accordingly.
There seems to be a fix for it already, maybe you can use this https://github.com/rubenspgcavalcante/webpack-extension-reloader/pull/139/files @rushilsrivastava?
It's described more here: rubenspgcavalcante/webpack-extension-reloader#125
Hey guys, I just submitted a PR to fix this issue. My setup is MacOS Chrome + MV3. Both the extension and background page are working fine with this PR, leaving the content script untested. Feel free to use my fork before the PR merged.
I been using reorx fork for now, any plans to merge it in?
At the moment, this will not work with MV3. However, we plan to release this functionality in the near future.
come on
I intend to merge one of the open PRs by the end of November. There seems to be open review comments/concerns on each one of these PRs at the moment
I intend to merge one of the open PRs by the end of November. There seems to be open review comments/concerns on each one of these PRs at the moment
There are two ways to resole the problem.
- remove polyfill, which is not required in MV3
- extend polyfill namespace for
browser.runtime
tochrome.runtime
andbrowser.tabs
tochrome.tabs
I adapted @sherifmayika 's advice and finally made my fork work. Please try https://github.com/reorx/webpack-ext-reloader, which should be fully compatible with MV3.
I adapted @sherifmayika 's advice and finally made my fork work. Please try https://github.com/reorx/webpack-ext-reloader, which should be fully compatible with MV3.
is it published to NPM?
@reorx thanks for taking the initiative! Your fork doesn't seem to work for me though, getting an error:
.
Reproduction: https://github.com/just-jeb/angular-chrome-extension/tree/mv3-background-reload
git clone
yarn
yarn watch
- Load as unpacked from the
dist/angular-chrome-extension
folder
If by instruction you mean readme then it does follow the instruction.
As for development environment - the whole point of this plugin is to work with development
mode, am I missing something?
@reorx thanks for taking the initiative! Your fork doesn't seem to work for me though, getting an error: .
Reproduction: https://github.com/just-jeb/angular-chrome-extension/tree/mv3-background-reload
git clone
yarn
yarn watch
- Load as unpacked from the
dist/angular-chrome-extension
folder
-(function(_window) {
-let window: any
-if (_window.document !== undefined) {
-window = _window
-}
+(function() {
+try {window} catch {var window: any;};
Or
(function(_window) {
let window: any
if (_window?.document !== undefined) {
window = _window
}
I guess it does the same.
Or
(function(_window) { let window: any if (_window?.document !== undefined) { window = _window }I guess it does the same.
try instead of guess
Thank you for such a useful comment.
Or
(function(_window) { let window: any if (_window?.document !== undefined) { window = _window }I guess it does the same.
did you test?
Any updates regarding manifest v3 support?
@xadamxk https://github.com/reorx/webpack-ext-reloader is working properly in my projects, you can have a try
Any hints on how to resolve the "Uncaught TypeError: Cannot read properties of undefined (reading 'document')" issue? @reorx
Any hints on how to resolve the "Uncaught TypeError: Cannot read properties of undefined (reading 'document')" issue? @reorx
It's broken and is not being maintained, use this fork instead: https://github.com/reorx/webpack-ext-reloader
Any hints on how to resolve the "Uncaught TypeError: Cannot read properties of undefined (reading 'document')" issue? @reorx
It's broken and is not being maintained, use this fork instead: https://github.com/reorx/webpack-ext-reloader
There are 3 open PRs for Manifest V3, each has there own issues. I'll see if I can clean them up soon, but this repo is being maintained for V2.
It comes from the code that is generated by webpack-ext-reloader
(as you can see from the screenshot). I assume it pops up because window
does not exist in service workers. I mean there is a fallback for { browser: null }
but seems like the browser will throw this error upon any use of window
in the service worker.
And it seems to result in service worker not working at all.
And it seems to result in service worker not working at all.
We're using this in a MV3 service worker without issue (aside from a separate library causing issues in the SW), which is why your comment doesn't make sense to me.
I will look further into this today.
To all who are concerned about this project, I have updated @reorx/webpack-ext-reloader to version 1.6.0, which addresses a persistent issue where the plugin continually raised errors, significantly disrupting the development experience. The errors in question were primarily the following:
Uncaught (in promise) Error: Could not establish connection. Receiving end does not exist.
: This error occurred when the plugin's code attempted to send a message to a tab that did not have a message listener. It has been resolved by adding a.catch
statement after the.sendMessage
call.WebSocket is already in CLOSING or CLOSED state
: This error commonly appeared after the extension reloaded, when trying to send reload results to a server that was either down or when the socket instance had become outdated. This has been corrected by adding a state check before invokingsocket.send
.Websocket HTTP Authentication failed; no valid credentials available
: This error surfaced if the webpack process was terminated, as the plugin would then repeatedly attempt to reconnect to the server. It was challenging due to its origin in the 'new WebSocket', which made it impossible to prevent the error from displaying in the console. The fix involved implementing an HTTP server on the same port and using afetch
request to this server as a reconnect attempt.
Overall, @reorx/webpack-ext-reloader
is now more robust against errors. You can confidently assume that any errors appearing in chrome://extensions
are worth investigating without having to manually clear them out repeatedly.
Additional quality-of-life improvements include:
- A clear distinction between changes made to the background, content scripts, and extension pages, ensuring that only the relevant tabs are refreshed. For example, the extension itself will not reload unless changes are made to the background, and side panels remain open after making non-background updates.
- To prevent Chrome from terminating an inactive service worker, content scripts and extension pages now send periodic ping/pong messages to the background. This replaces the previous workaround of having to keep the developer tools open for the background page to keep it alive. Therefore, if your extension has any content scripts or extension pages running, it will automatically reload without needing to keep the developer tools open.