How to modify service worker file without overwriting it with ng build --prod

I want to update my service worker so I can receive notifications, the problem is every time I run ng build --prod it overwrites my files.I created the service worker with the Angular CLI. If I understand it correctly I need to run the ng build --prod script to update the dist folder to deploy.I update the ngsw-worker.js in the dist folder but it gets overwritten when I run the build command. I also have to add the Web.config manually to the dist folder everytime. How do take those changes with the build?...Read more

Angular service worker debugging information under ngsw/state virtual directory?

I am in reference to angular service workers and debugging (see following link: https://angular.io/guide/service-worker-devops#locating-and-analyzing-debugging-information).To quote the documentation: The Angular service worker exposes debugging information under the ngsw/ virtual directory. Currently, the single exposed URL is ngsw/state.I haven't been able to find the ngsw/state debugging information on the https://angular.io/ progressive web app: I tried appending ngsw/state as follows: https://angular.io/ngsw/state to no avail. I could n...Read more

Why can't I change href programmatically when Angular Service worker is used?

I'm trying to change a link's href programmatically in an external webpage that uses an Angular Service worker.The link looks like <a _ngcontent-c32="" href="/something">Something</a> and uses this EventListener:function(e){if(e=e||t.event){var n=this||e.target||t,r=n[C[e.type][f]];if(r)if(1===r.length)y(r[0],n,e);else for(var i=r.slice(),o=0;o<i.length&&(!e||!0!==e[z]);o++)y(i[o],n,e)}}When I rundocument.querySelector('a').setAttribute('href', '/something-else') or document.querySelector('a').href = '/something-else' I c...Read more

@angular/service-worker silent failure

I have used the @angular/service-worker module successfully in several projects but am running into a silent failure issue on my latest project that I can't seem to debug. My configuration and setup is identical to other projects, and the outputted build (via CLI v1.6.2) seems correct:dist (partial)My initial thought was there was something wrong with my environment variable so I went through logging to ensure enabled was true after build, even went as far as hardcoding it in all environments just to test:ServiceWorkerModule.register('/ngsw-wor...Read more

How can I externally inject a new link in an Angular Service Worker webpage and click it without reloading the entire page?

There's an external page that uses Angular Service Worker in which all links open internally without reloading the entire webpage.But when I try to run a script that injects new links, then clicking those links (both manually and through JS) works but causes to reload the entire page, thus cutting off the script.The question is - Is there something that can force the webpage not to reload when clicking those links and just treat them like the original links?The links that can be clicked without reloading the entire page look like<a _ngconten...Read more