2

In manifest v2, I've used chrome.runtime.getPackageDirectoryEntry in the background script to list all the files within a subfolder that came with the extension to realize a specific design feature.

Now that Google is forcing me to migrate my extension from manifest v2 standard to manifest v3, I tried to do the same feature using the chrome.runtime.getPackageDirectoryEntry method but chrome would simply report this error:

Uncaught TypeError: chrome.runtime.getPackageDirectoryEntry is not a function

Can anyone help with this please? or provide an alternative method for me to list all the filenames in a specified subfolder that would be shipped within the extension?

Jake
  • 21
  • 2
  • 1
    I googled and came across this https://stackoverflow.com/questions/66066405/chrome-runtime-missing-properties-in-manifest-v3 which linked to this https://stackoverflow.com/questions/65975659/how-do-i-get-access-to-all-the-files-in-the-extension-in-chrome-extension-manife/65976345#65976345 all here on stackoverflow – Bravo Mar 07 '22 at 07:53
  • you had me at really sucks :p – Bravo Mar 10 '22 at 09:53

1 Answers1

0

After some trial and error, I've found a workaround!

For those having the same problem, one can simply choose to invoke the chrome.runtime.getPackageDirectoryEntry method in a js script that is added onto the pupup html of the chrome extension.

Jake
  • 21
  • 2