After Angular 6 update, ng build --prod yields "Error: Expected to find an ngsw-config.json configuration file"

Please make sure to build your app in root folder. I had the same issue and building from the root folder solved my issue.


I'm not sure how "ngswConfigPath": "/src/ngsw-config.json", was added, but I removed it and it built fine.

Next issue I faced was that ngsw-config.json has been moved out of src and to the project root during the upgrade. I had to copy my updates into the root ngsw-config.json for the service worker to register properly.


For my case issue was connected with / sign added at the front of the path, so instead of "ngswConfigPath": "/src/ngsw-config.json" I've used "ngswConfigPath": "src/ngsw-config.json" and issue fixed.