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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: ServiceWorker support in CLI #4006

Closed
hansl opened this issue Jan 13, 2017 · 15 comments
Closed

Feature: ServiceWorker support in CLI #4006

hansl opened this issue Jan 13, 2017 · 15 comments
Assignees
Labels
P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent

Comments

@hansl
Copy link
Contributor

hansl commented Jan 13, 2017

Requested by @alxhub.

This is non 1.0 blocking but will be tracked in the 1.0.

@coryrylan
Copy link
Contributor

For reference for anyone who wants to use service workers with the CLI now its not to much work using the sw-precache library. I have a blog post and working demo here. https://coryrylan.com/blog/fast-offline-angular-apps-with-service-workers

@filipesilva filipesilva added command: build P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent labels Jan 24, 2017
@justingrayston
Copy link
Contributor

@hansl I notice that this is marked Done in Tracking and I see @alxhub branch here https://github.com/alxhub/angular-cli/tree/sw-support do you have an idea of when this might get a PR? I know you guys are really busy and you are doing a great job, I only ask because I was thinking of trying to figure out some plugin to help server a service worker. So before I get my hands too dirty, I thought I'd be cheeky and see if we are looking weeks or months here?

@filipesilva
Copy link
Contributor

Closed via cb2e418

@justingrayston
Copy link
Contributor

Awesome, sorry I didn't see it.

@alexjlockwood
Copy link

I'm having trouble getting this to work... and I feel like it has something to do with the fact that I'm setting --base-href=/SubDirectory/ when I build. Any reason why the service worker wouldn't work when this argument is set?

@osnoser1
Copy link

Maybe this will help: Feature: Route redirection to index.html.
@alexjlockwood

@alexjlockwood
Copy link

@osnoser1 Thanks for the tip! Are you suggesting I manually update the ngsw-manifest.json file after I build?

@osnoser1
Copy link

For now yes. 😃

@alxhub
Copy link
Member

alxhub commented Feb 21, 2017

@alexjlockwood, create a ngsw-manifest.json file with only the routing config specified in your project root. The generated manifest with file hashes will be merged into it at build time.

@alexjlockwood
Copy link

@alxhub Sorry for being a complete noob here, but do you mean like this?

{
  "routing": {
    "index": "/index.html",
    "routes": {
      "/": {
        "prefix": false
      },
      "/ShapeShifter": {
        "prefix": true
      }
    }
  }
}

My web app is here... I'm building it using ng build --prod --base-href=/ShapeShifter/ so that it serves at https://alexjlockwood.github.io/ShapeShifter. Not exactly sure what the desired ngsw-manifest.json end result is supposed to look like though.

@alexjlockwood
Copy link

@alxhub Friendly ping. :)

@alexjlockwood
Copy link

The problem I seem to be having is that the browser is still trying to retrieve the ngsw-manifest.json file from https://alexjlockwood.github.io/ngsw-manifest.json when it is actually located at https://alexjlockwood.github.io/ShapeShifter/ngsw-manifest.json. Is this something that can be changed via the routing config above?

@jvitor83
Copy link

jvitor83 commented Apr 8, 2017

@alxhub

I think that --base-href=/SubDirectory/ should be concated to the ngsw-manifest.json at routing.index.

Resulting in /SubDirectory/index.html to the sw.

@alexjlockwood
Copy link

Just a quick follow up... I ended up filing #5186 and once that got fixed everything seemed to work fine for me.

@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 Sep 7, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent
Projects
None yet
Development

No branches or pull requests

8 participants