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.

ServiceWorker are not using --deploy-url

See original GitHub issue

The service worker is loaded from the base url which is not working if i set a deploy-url

Versions

Angular CLI: 1.6.5
Node: 8.9.4
OS: darwin x64
Angular: 5.2.1
... animations, common, compiler, compiler-cli, core, forms
... http, language-service, platform-browser
... platform-browser-dynamic, router, service-worker

@angular/cli: 1.6.5
@angular-devkit/build-optimizer: 0.0.42
@angular-devkit/core: 0.0.29
@angular-devkit/schematics: 0.0.52
@ngtools/json-schema: 1.1.0
@ngtools/webpack: 1.9.5
@schematics/angular: 0.1.17
typescript: 2.6.2
webpack: 3.10.0

Repro steps

  • ng build --deploy-url something/different/than/the/base/url

Observed behavior

Angular uses the base url instead of deploy-url

Desired behavior

The service worker is loaded by following rules:

  1. take absolute url if given
  2. fallback to deploy-url
  3. fallback to base url

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:7
  • Comments:15 (3 by maintainers)

github_iconTop GitHub Comments

9reactions
santialbo-actimocommented, Jun 26, 2018

This is quite an important bug. Can we maybe remove the freq1: low tag so it gets a little more attention and love?

2reactions
santialbo-actimocommented, Jun 26, 2018

For anyone reading this, I managed to get around without too much messing around by re-generating the ngsw.json with the following command

./node_modules/.bin/ngsw-config myDistFolder pathToNgswConfig deployUrl

in my case

./node_modules/.bin/ngsw-config dist/apps/viewer ./ngsw-config.json /viewer
Read more comments on GitHub >

github_iconTop Results From Across the Web

ServiceWorker are not using --deploy-url #12322 - GitHub
I need to build the app using --deploy-url specifically (and not with href) and the urls generated in the service worker do not...
Read more >
Angular application in custom url path, with ServiceWorker
One way to modify paths that Angular generates while building is to use the --deploy-url option with CLI's ng build . In combination...
Read more >
angular/angular-cli - Gitter
hey guys, how use --deploy-url feature when use webpack(@ngtools/webpack)? ... on gh-pages ( http://susper.com ) is not serving files using service worker.
Read more >
Deployment - Angular
A command line option used to specify the base path for resolving relative URLs for assets such as images, scripts, and style sheets...
Read more >
Concept - Intershop Progressive Web App - Deploy URL
Deploy URL. This document describes how to provide the Intershop PWA with a dynamic deploy URL to set up client-side retrieval of static ......
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