question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

ng build --watch does not generate ngsw pwa workers.

See original GitHub issue

🐞 Bug report

ng build --watch does not generate ngsw-worker.js, and siblings.

Command (mark with an x)

  • new
  • build
  • serve
  • test
  • e2e
  • generate
  • add
  • update
  • lint
  • xi18n
  • run
  • config
  • help
  • version
  • doc

Is this a regression?

Not sure. Had the same problem with angular 8, figured out it was the watch flag only after i upgraded to 9.

Description

ng build --watch --prod: no ngsw-worker & siblings under dist/project ng build --watch --prod: ngsw-worker & siblings are generated under dist/project

🔬 Minimal Reproduction

new new foo cd foo ng add @angular/pwa ng build --watch --prod

🌍 Your Environment


     _                      _                 ____ _     ___
    / \   _ __   __ _ _   _| | __ _ _ __     / ___| |   |_ _|
   / △ \ | '_ \ / _` | | | | |/ _` | '__|   | |   | |    | |
  / ___ \| | | | (_| | |_| | | (_| | |      | |___| |___ | |
 /_/   \_\_| |_|\__, |\__,_|_|\__,_|_|       \____|_____|___|
                |___/
    

Angular CLI: 9.0.1
Node: 10.17.0
OS: linux x64

Angular: 9.0.0
... animations, common, compiler, compiler-cli, core, forms
... language-service, localize, platform-browser
... platform-browser-dynamic, router, service-worker
Ivy Workspace: Yes

Package                           Version
-----------------------------------------------------------
@angular-devkit/architect         0.900.1
@angular-devkit/build-angular     0.900.1
@angular-devkit/build-optimizer   0.900.1
@angular-devkit/build-webpack     0.900.1
@angular-devkit/core              9.0.1
@angular-devkit/schematics        9.0.1
@angular/cli                      9.0.1
@ngtools/webpack                  9.0.1
@schematics/angular               9.0.1
@schematics/update                0.900.1
rxjs                              6.5.4
typescript                        3.7.5
webpack                           4.41.2


Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:1
  • Comments:6

github_iconTop GitHub Comments

4reactions
axos88commented, Feb 8, 2020

Well, I just pulled my remaining hairs out by design then…

At least a warning and an option to turn this off would be great, because I am usually working with ng build --watch running in the background, and spent hours trying to figure out why they don’t get generated

0reactions
angular-automatic-lock-bot[bot]commented, Sep 6, 2020

This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Angular Service Worker - Step-By-Step Guide
The first step to create an Angular PWA is to upgrade the Angular CLI ... The build configuration file ngsw-config.json ... ng build...
Read more >
Getting started with service workers - Angular
To set up the Angular service worker in your project, use the CLI command ng add @angular/pwa . It takes care of configuring...
Read more >
Getting started with service workers - Angular
To set up the Angular service worker in your project, use the CLI command ng add @angular/pwa . It takes care of configuring...
Read more >
Angular PWA missing ngsw.json and ngsw-worker file
when I am building in production mode I am not getting ngsw-worker.js and ngsw.json files in my dist folder. the pwa version am...
Read more >
Angular service worker not showing : r/Angular2 - Reddit
The service worker does not work with ng-serve! You need to use a real Webserver like http-server from npm for the service worker...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found