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

firebase-messaging-sw.js in subfolder? #4

Open
ngekoding opened this issue Jan 28, 2021 · 2 comments
Open

firebase-messaging-sw.js in subfolder? #4

ngekoding opened this issue Jan 28, 2021 · 2 comments

Comments

@ngekoding
Copy link

Hi, thanks for this awesome work.

I was integrating this and found the error after build, because the app trying to find firebase-messaging-sw.js in root, but my app in subfolder.

Here the app url: domain.com/my-app

How can I solve this?

@motia
Copy link
Owner

motia commented Jan 28, 2021

Hi,
You could try to add the subdirectory as a prefix to the path here:

scripts.unshift('/service-worker.js?' + Date.now())

// replace line
register(process.env.SERVICE_WORKER_FILE, {
--->
// by
register(`${subdirectory}/firebase-messaging-sw.js`, {

Let me know if it works

@ngekoding
Copy link
Author

Thanks for the reply, but still not working.
When checking the Console, the error says that the app trying to find /service-worker.js (root)

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

2 participants