VasilyShelkov/create-react-extension

Cannot import scripts in background script with importScripts (service worker)

Danscap opened this issue · 0 comments

As you can see here,

image

using self.importScripts('../pathtojavascriptfile.js') is broken. I'm not sure if this is a webpack issue,
but using this normally in a background.js script without create-react-extension works.

Does anyone have a possible fix for this?

Edit

The reason this is so important is because in MV3 with the limitation of service workers, you cannot import files the way you would in another javascript or react file, you must use self.importScripts() to import local files.

This is the only way for services like Firebase to be integrated into your extension.
And this is currently impossible because of this bug.