Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I get access to all the files in the extension in Chrome Extension Manifest Version 3 (MV3)?

Background

I've been using the crx-hotreload package to auto-reload my chrome extensions during development because it's annoying to have to click the refresh button on the Extensions page every time you make a change; however, this package doesn't work with MV3 because it uses the chrome.runtime.getPackageDirectoryEntry method, which seems to have been removed from chrome.runtime in MV3. I can't find documentation to confirm that it was removed, but it's not there when I try to use it.

Questions

Does anyone know how to get access to all the files in the extension directory in Chrome Extension Manifest Version 3?

Or generally, is there a better way that I can hot-reload my chrome extensions during development that would work for MV3?

like image 973
mdaddy Avatar asked Oct 27 '22 14:10

mdaddy


1 Answers

This is one of many things based on DOM capabilities of background pages that are removed from ManifestV3 because service workers don't have DOM. For example, getPackageDirectoryEntry is using the old nonstandard FileSystem API in its returned value.

As to why, apparently the switch to service workers simplifies the internal source code in Chromium, even if it doesn't provide any real improvements for extension authors or users.

At this point all you can do is present a convincing use case and ask Chromium developers via https://crbug.com to implement an alternative API.

like image 112
wOxxOm Avatar answered Oct 29 '22 22:10

wOxxOm