Skip to content

[PWA] ngsw.json assetGroups are blank in Angular 12 (cause 504 error) #20894

Closed
@redplane

Description

@redplane

Bug Report

Affected Package

The issue is caused by package @angular/....

"@angular/service-worker": "^12.0.0"

Is this a regression?

  • (Haven't tried with ealier version)

Description

  1. Follow instruction in Angular official tutorial about PWA
  2. Host application using http-server (mentioned in the above tutorial)
  3. Set chrome to ONLINE and load the page
  4. Set chrome to OFFLINE and press F5 to reload the loaded page

Minimal Reproduction

Exception or Error

image

Your Environment

Angular Version:


Angular CLI: 12.0.0
Node: 14.17.0
Package Manager: npm 6.14.9
OS: win32 x64

Angular: 12.0.0
... animations, cli, common, compiler, compiler-cli, core, forms
... language-service, localize, platform-browser
... platform-browser-dynamic, platform-server, router
... service-worker, upgrade

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1200.0
@angular-devkit/build-angular   12.0.0
@angular-devkit/core            12.0.0
@angular-devkit/schematics      12.0.0
@schematics/angular             12.0.0
rxjs                            6.6.7
typescript                      4.2.4

Anything else relevant?
What I notice is:

  • In the generated ngsw.json, the urls in both app and assets section inside assetGroups are all blank (see the below image)

image

  • When I filled values into urls as the below image, the PWA worked perfectly. App can work in Offline mode

image

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions