angular-service-worker

How to have a service worker with a runtime enabled option?

社会主义新天地 提交于 2021-01-29 14:34:57
问题 I created a lib-pwa library that takes care of the service worker. Because it's a library I have to feed it the environment from the client application, and not use a local environment definition. To this end, I use the ng-environmenter dependency in the module of the library. import { Environmenter } from 'ng-environmenter'; function serviceWorkerFactory(environmenter: Environmenter): SwRegistrationOptions { const isProduction: boolean = environmenter.getGlobalEnvironment().environment

How to edit your service worker file for an Angular CLI project

帅比萌擦擦* 提交于 2020-12-15 05:32:41
问题 I have added the @angular/pwa package to my Angular CLI project with the command ng add @angular/pwa --project *project-name* so it becomes a progressive web applicaiton, and this adds a service worker I know. I want to edit that default service worker to support e.g. handling Shared Targets links. I see that the service worker is registered to a file calleded ngsw-worker.js using the "Inspect" option in Google Chrome. How can I edit that service worker ( ngsw-worker.js ) created by the

No Service worker files ngsw.json / ngsw-worker.json generated when running build --prod. Angular 5

删除回忆录丶 提交于 2020-12-02 07:15:36
问题 Using angular 5.1.2 Angular-cli 1.6.3 all files are pretty vanilla. dist folder is created My ngsw-config.json { "index": "/index.html", "assetGroups": [ { "name": "app", "installMode": "prefetch", "resources": { "files": [ "/favicon.ico", "/index.html" ], "versionedFiles": [ "/*.bundle.css", "/*.bundle.js", "/*.chunk.js" ] } }, { "name": "assets", "installMode": "lazy", "updateMode": "prefetch", "resources": { "files": [ "/assets/**" ] } }] } my app.module.ts uses ServiceWorkerModule

No Service worker files ngsw.json / ngsw-worker.json generated when running build --prod. Angular 5

|▌冷眼眸甩不掉的悲伤 提交于 2020-12-02 07:15:21
问题 Using angular 5.1.2 Angular-cli 1.6.3 all files are pretty vanilla. dist folder is created My ngsw-config.json { "index": "/index.html", "assetGroups": [ { "name": "app", "installMode": "prefetch", "resources": { "files": [ "/favicon.ico", "/index.html" ], "versionedFiles": [ "/*.bundle.css", "/*.bundle.js", "/*.chunk.js" ] } }, { "name": "assets", "installMode": "lazy", "updateMode": "prefetch", "resources": { "files": [ "/assets/**" ] } }] } my app.module.ts uses ServiceWorkerModule

Update Angular app on AWS S3 + Cloudfront

こ雲淡風輕ζ 提交于 2020-08-09 19:06:48
问题 I deployed a production Angular 9 application on S3 + cloudfront. It works very well but I've some problems every time I release a new update of the application. I read many articles: https://medium.com/@sumn2u/react-progressive-web-app-s3-and-cloudfront-6c890fa873fb https://medium.com/driven-by-code/on-the-importance-of-correct-headers-and-metadata-in-s3-origins-for-aws-cloudfront-50da2f9370ae I set right caching for index.html and ngsw-worker.js so they are not cached from cloudFront. Every

Update Angular app on AWS S3 + Cloudfront

若如初见. 提交于 2020-08-09 19:06:03
问题 I deployed a production Angular 9 application on S3 + cloudfront. It works very well but I've some problems every time I release a new update of the application. I read many articles: https://medium.com/@sumn2u/react-progressive-web-app-s3-and-cloudfront-6c890fa873fb https://medium.com/driven-by-code/on-the-importance-of-correct-headers-and-metadata-in-s3-origins-for-aws-cloudfront-50da2f9370ae I set right caching for index.html and ngsw-worker.js so they are not cached from cloudFront. Every

Angular service worker with @angular/pwa package showing `HTTP error 504` when offline

本小妞迷上赌 提交于 2020-06-16 03:24:14
问题 I am working on an angular PWA application. So I added an npm package by ng add @angular/pwa . It is added successfully with no errors. The generated Manifest is working fine. But I am facing issues with the service worker. When the application goes online it stores all the caches (see attachment) but whenever the application goes offline, instead of serving the request from the service worker it shows the error - HTTP ERROR 504 Here is my ngsw-config.json - { "index": "/index.html",