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

Doesn't register Service Worker #6

Open
milostomsik1 opened this issue Jun 1, 2018 · 6 comments
Open

Doesn't register Service Worker #6

milostomsik1 opened this issue Jun 1, 2018 · 6 comments

Comments

@milostomsik1
Copy link

I have tried the starter, but couldn't manage to get the app to register SW in ssr mode. It registers SW in client only mode as expected.

@lukeed
Copy link
Owner

lukeed commented Jun 1, 2018

Not sure what you mean by registering in ssr mode. ServiceWorkers won't run in a server as they're only meant for browsers.

@milostomsik1
Copy link
Author

When you run server side rendering and visit lets say '/', server sends prerendered html and css, client gets the page and bootstraps bundle.js but doesn't register service worker. If it's unclear please run your seed and run lighthouse audit on chrome dev tools, it only scores 64.

@lukeed
Copy link
Owner

lukeed commented Jun 1, 2018

Ah, you must be on localhost.

The current preact-cli version that is attached has a manual location.protocol === 'https' check within the main bundle script. You should edit the minified bundle and remove that clause for local testing. You won't have to do this for your prod deploy with ssl certificates.

Other option is to use preact-cli@next instead, which has removed this clause.

@lukeed
Copy link
Owner

lukeed commented Jun 3, 2018

@milostomsik1 Did you figure it out?

@milostomsik1
Copy link
Author

I haven't tried yet, I'll try when I get the time. I haven't been on pc during the weekend. I'll let you know. Thank you.

@lukeed
Copy link
Owner

lukeed commented Jun 3, 2018

No worries, just checking in~

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