I made a little progress over my previous response. Instead of copying ngsw-worker.js with a Unix-style specific command in package.json, only working for build not serve, I edited .angular-cli.json to add the following to the “assets” array:

{ "glob": "ngsw-worker.js", "input": "../node_modules/@angular/service-worker/" }

The script is now available during ng server as well as being cross platform. Unfortunately the script then tries to load ngsw.json, which cannot be generated.

Seems the only way to test is to deploy to a real web server — which I realize needs to support https as well.

I’d like to see a follow-up guide (or actual documentation on angular.io!) that closes the loop on all of this.

Lead Software Architect and AWS Solutions Architect, specializing in cloud native development as well as web clients. Also, a square dance caller. 🤷‍♂️🕺🏻