0

I am new to polymer and I am trying to build a PWA application. I followed their starter kit which can be viewed here. But I cant make the generated service-worker.js work when i pass -P https or -H 192.168.10.98 on polymer serve command. Although not passing the parameters makes the service-worker work without any errors.

This is how I follow the instruction in the way I understood them,

  1. First I do polymer build

  2. Then I copy the folder inside the build file with the es* bundle that i want.

  3. Inside the copied folder I do polymer serve.

If I execute polymer serve alone, everything in service worker works fine,

But when i do polymer serve -P https or polymer serve -H 192.168.10.98 the app gets loaded but without the PWA service worker functionality which is resiliency in offline situation.

I am stuck with this problem for days and I will really appreciate any help regarding this

Alex Sergeenko
  • 642
  • 5
  • 22

1 Answers1

0

This happens because service worker does not work with self-signed certificates by default.

Because of this, the service-worker.js loaded by Polymer is not loaded properly.

To make it work using self signed certificate, i need to launch chrome with this command as we need to pass extra parameters.

'chrome.exe --user-data-dir=C:\Users\Wayne\AppData\Local\Temp --ignore-certificate-errors --unsafely-treat-insecure-origin-as-secure=https:/localhost:8081/'