Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Service worker broken when ng build with custom base href #15025

Closed
jscti opened this issue Jul 9, 2019 · 7 comments
Closed

Service worker broken when ng build with custom base href #15025

jscti opened this issue Jul 9, 2019 · 7 comments
Labels
needs: repro steps We cannot reproduce the issue with the information given

Comments

@jscti
Copy link

jscti commented Jul 9, 2019

馃悶 Bug report

Command (mark with an x)

- [ ] new
- [ *] build
- [ ] serve
- [ ] test
- [ ] e2e
- [ ] generate
- [ ] add
- [ ] update
- [ ] lint
- [ ] xi18n
- [ ] run
- [ ] config
- [ ] help
- [ ] version
- [ ] doc

Is this a regression?

Don't know

Description

Service worker isn't registered (ngsw-worker.js never called) when building with a custom --base-href.
Related stackoverflow post : https://stackoverflow.com/questions/53329924/angular-7-service-worker-not-registered
Related closed issue : #13351

馃敩 Minimal Reproduction

On localhost, I have 2 apps :

  • 1 with default base-href : service Worker working without problem ng build --project=projectA
  • 1 with custom base-href (given from the cli ng build --project=projectB --base-href=/projectB/

Manifest reflects this with start_url and scope to "/projectB"

馃敟 Exception or Error

馃實 Your Environment

Angular CLI: 8.1.0
Node: 10.15.3
OS: darwin x64
Angular: 8.1.0
... animations, cli, common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... router, service-worker

Package                            Version
------------------------------------------------------------
@angular-devkit/architect          0.801.0
@angular-devkit/build-angular      0.801.0
@angular-devkit/build-ng-packagr   0.801.0
@angular-devkit/build-optimizer    0.801.0
@angular-devkit/build-webpack      0.801.0
@angular-devkit/core               8.1.0
@angular-devkit/schematics         8.1.0
@angular/cdk                       8.0.2
@angular/fire                      5.2.1
@angular/flex-layout               8.0.0-beta.26
@angular/http                      7.2.15
@angular/material                  8.0.2
@angular/pwa                       0.801.0
@ngtools/json-schema               1.1.0
@ngtools/webpack                   8.1.0
@schematics/angular                8.1.0
@schematics/update                 0.801.0
ng-packagr                         5.3.0
rxjs                               6.5.2
typescript                         3.4.5
webpack                            4.35.2

Tried to :

  • register it relatively with "./ngsw-worker.js" without success
  • manual register in browser console works (after app load)
  • deps updated to latests
  • Note that the workaround provided in the SO post works totally (= angular.json, ngsw-config, manifest file is well configured)
@alan-agius4
Copy link
Collaborator

@gkalpak, I think this might be some related more to the service-worker package.

@gkalpak
Copy link
Member

gkalpak commented Jul 10, 2019

Hard to tell what this is related with, without a minimal reproduction. (For example, the SO question mentions http://127.0.0.1 which will of course not work, because SW requires HTTPS or localhost (not 127.0.0.1).)

I would be happy to investigate this, if someone can provide a minimal reproduction (i.e. a ZIP file I can download or a repo I can check out and run a command to see the problem).

@alan-agius4
Copy link
Collaborator

alan-agius4 commented Jul 11, 2019

@jscti, it would be great if you can provide a minimal repo to speed up the process in looking into the issue.

Thanks

@alan-agius4 alan-agius4 added the needs: repro steps We cannot reproduce the issue with the information given label Jul 11, 2019
@vmagalhaes
Copy link

Same thing on Angular CLI 7.3.6, any update?

@AkshayRaut1321
Copy link

This might help:

#8515 (comment)
OR
#13351 (comment)

@alan-agius4
Copy link
Collaborator

Closing as a reproduction has not been provided.

If this issue is still present in the latest version of Angular. Please open a new issue with a minimal reproduction. Thanks.

@angular-automatic-lock-bot
Copy link

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.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Feb 24, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
needs: repro steps We cannot reproduce the issue with the information given
Projects
None yet
Development

No branches or pull requests

5 participants