Service worker over http: An SSL certificate error occurred when fetching the script

Service Workers can only be used over an HTTPS connection. Are you using that or not? Also, the HTTPS certificate has to be valid.

As a sidenote, the code you're showing is not your service-worker.js. That code is some parameters and options to some SW library that then generates your service-worker.js based on those options. Most likely your actual service-worker.js is located in the dist directory and is updated as a part of your build process.