compiler, service-worker, Don't known / other
After upgrading to Angular 14, when a change is made to html or js in visual studio code, the compiler will complete and the browser will refresh x times (sometimes around 20) when service worker is enabled. When it is disabled the browser will reload once. No console errors are present, the service worker shows as being installed successfully through dev tools
there was no exception, the browser gets stuck in a loop for a while
Angular CLI: 14.2.2 Node: 14.15.4 Package Manager: npm 6.14.10 OS: win32 x64 Angular: 14.2.1 ... cdk, common, compiler, compiler-cli, core, elements, forms ... router, service-worker Package Version ------------------------------------------------------------- @angular-devkit/architect 0.1402.2 @angular-devkit/build-angular 14.2.2 @angular-devkit/core 14.2.2 @angular-devkit/schematics 14.2.2 (cli-only) @angular/cli 14.2.2 @angular/platform-browser 14.2.2 @angular/platform-browser-dynamic 14.2.2 @schematics/angular 14.2.2 (cli-only) typescript 4.7.4 webpack 5.74.0
cut down repro above
I can confirm this does happen
I see that you have
production: true in your development config, which activates the ServiceWorker. I think I recall that the ServiceWorker used to not work with
ng serve (even when targeting
production), but I am not sure if this has changed.
Generally, the ServiceWorker is not supposed to be used in development (with live-reload enabled), but I am not sure if it ever worked and if it accidentally broken.
@AnnaO555, you mention that it broken while upgrading to v14. What is the previous version that you used and this setup worked?
Thx for the info, @AnnaO555.
It is probably because the Angular CLI did not include the SW in the build with
ng serve before 14.2.0.
If you don't need the SW in dev mode (which you probably don't), you could try setting a property (for example,
serviceWorker: true/false) in your environment configs (setting it to
true for production and
false for dev) and then using that to configure the
|Issue Title||Created Date||Updated Date|