Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

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

Open
Danscap opened this issue Apr 18, 2022 · 0 comments

Comments

@Danscap
Copy link

Danscap commented Apr 18, 2022

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant