Repository navigation
Conversation
There was a problem hiding this comment.
🎉 ✨ (Quite excited about the dynamic content caching 😄)
A couple of comments/questions:
- You can now remove the
--ignore-packages @angular/service-workerpart from here. - The
SwUpdatesServicespec needs to be updated too 😁 - Do we still need ngsw-manifest.json?
There was a problem hiding this comment.
Nit: Update event --> Activation event
There was a problem hiding this comment.
Will the ServiceWorker still be registered on production only?
(How does it know which environment it is in?)
There was a problem hiding this comment.
The module is only added if environment.production is set.
There was a problem hiding this comment.
Will that work fine if the SW support doesn't exist at runtime (e.g. ios)?
There was a problem hiding this comment.
Yes, the module itself does feature detection to decide whether to register the SW.
There was a problem hiding this comment.
How does the new ServiceWorker handle routing? (For reference this was our previous config.)
There was a problem hiding this comment.
AFAICT, it is possible to follow the previous config more closely (if not exactly) wrt to what gets cached and when.
Have you intentionally deviated from it?
There was a problem hiding this comment.
Just out of curiosity, couldn't you use assets of the CLI?
There was a problem hiding this comment.
The SW script has to be registered at the root of the page's origin, it can't come from a subdirectory.
There was a problem hiding this comment.
I'd move this block with fonts to a separate group, because it will not follow prefetch rule anyway
There was a problem hiding this comment.
It's conceptually part of the site.
There was a problem hiding this comment.
My IDE says we have to add import 'rxjs/add/operator/do';
Splaktar
left a comment
There was a problem hiding this comment.
This will be a really useful 'real world' example once it gets to production!
There was a problem hiding this comment.
Need to rebase to master to pick up 6b74883 and then update this to 5.0.0. It probably also worth using the Angular CLI 1.6.0-beta.0 release that supports Angular Service Worker.
|
@alxhub can you please resurrect this PR and get it into a mergable state? thanks! |
fb0cbb6 to
35707ab
Compare
|
@IgorMinar PTAL. |
IgorMinar
left a comment
There was a problem hiding this comment.
I'm a bit concerned about the impact on ergonomics, let's discuss how we can resolve that - I'm afraid that this will require an API change/addition unless you have other ideas. Otherwise this looks good after the nitpicks are resolved.
There was a problem hiding this comment.
can't you update to cli@next and use the new build integration?
There was a problem hiding this comment.
Yes, I could. But I don't want to make more changes to AIO's build system than I need to.
There was a problem hiding this comment.
FWIW, we should soon upgrade to the latest-ish cli in #18428. So, maybe after that is merged you can use the build integration.
There was a problem hiding this comment.
odd.. why the change to polyfills size?
There was a problem hiding this comment.
No idea - it was failing.
There was a problem hiding this comment.
It couldn't be failing for a 2B diff 😕
(FWIW, I think the polyfills size has been 37070 for a while, but it wasn't updated in the limits, since it is a small changed - much lower than 1%).
There was a problem hiding this comment.
It's not fixed. Did you forget to push the change?
There was a problem hiding this comment.
Also, I'd expect the main size to decrease. Isn't that the case or is it less than 1% so the size check in CI doesn't fail?
There was a problem hiding this comment.
I'm not sure what you mean. It's probably less than 1%, this doesn't change much code.
There was a problem hiding this comment.
this is a bit odd, because it means that now you have to conditionally or optionally inject the ngsw services which makes the application code not very ergonomic.
There was a problem hiding this comment.
Good point. I will fix that.
There was a problem hiding this comment.
ouch. that's ugly. can we do better? either inject it optionally, or even better always register the providers and inject them, but if we are on browser without SW support or in Dev mode, then make the services inert.. or something like that. We should really rethink this, because the current ergonomics are bad. I believe that this is what Stephen was pointing out as well...
There was a problem hiding this comment.
Will that work fine if the SW support doesn't exist at runtime (e.g. ios)?
There was a problem hiding this comment.
please rename this to "app-shell"
There was a problem hiding this comment.
there are actually two docs content groups - the ones that are available offline, and those that are lazy downloaded.
The offline docs include all marketing pages and images under generated/marketing/ I believe - check what the current site is fetching: https://angular.io/ngsw-manifest.json
The the remaining docs and assets should be downloaded on as needed basis. Your proposal changes the update behavior (compared to current angular.io) - I'm fine experimenting with the prefetch mode. We'll see how well this user experience works.
There was a problem hiding this comment.
As discussed, the docs group has been moved to prefetch.
There was a problem hiding this comment.
It couldn't be failing for a 2B diff 😕
(FWIW, I think the polyfills size has been 37070 for a while, but it wasn't updated in the limits, since it is a small changed - much lower than 1%).
There was a problem hiding this comment.
Inconsistent spacing inside {...}.
I don't like the whitespace either, but... ¯\_(ツ)_/¯
There was a problem hiding this comment.
IIRC, we added this to improve TTI or something.
Is this now handled by the ServiceWorkerModule internally?
7e7d935 to
9d4d9d4
Compare
|
You can preview 1d82ed3 at https://pr19795-1d82ed3.ngbuilds.io/. |
|
You can preview 1896fa8 at https://pr19795-1896fa8.ngbuilds.io/. |
|
Note to caretaker: |
|
A Googler has manually verified that the CLAs look good. (Googler, please make sure the reason for overriding the CLA status is clearly documented in these comments.) |
`%%DEPLOYMENT_HOST%%` has been assumed to be the host prefix for sitemap URLs since bf29936, but afaict this was never the case.
AIO is currently using a beta version of @angular/service-worker. Since that was implemented, the SW has been rewritten and released as part of Angular 5.0.0. This commit updates AIO to use the latest implementation, with an appropriate configuration file that caches the various AIO assets in useful ways.
…vkit/build-angular to 0.7.0-rc.3
The is a bug in versions 0.6.8+ that breaks when trying to use Jasmine's mock clock. Related to angular/angular-cli#11626.
This allows URLs to be passed through to the server (where they are properly redirected), instead of serving `index.html` from the SW. Known issue: `/docs/` will be passed through to the server. `/docs` (without the trailing slash) will be correctly treated as a navigation URL and handled by the SW. We don't link to `/docs/` from within the app, but if there are external links to `/docs/` they will require a round-trip to the server and will not work in offline mode.
|
So there's good news and bad news. 👍 The good news is that everyone that needs to sign a CLA (the pull request submitter and all commit authors) have done so. Everything is all good there. 😕 The bad news is that it appears that one or more commits were authored or co-authored by someone other than the pull request submitter. We need to confirm that all authors are ok with their commits being contributed to this project. Please have them confirm that here in the pull request. Note to project maintainer: This is a terminal state, meaning the |
|
A Googler has manually verified that the CLAs look good. (Googler, please make sure the reason for overriding the CLA status is clearly documented in these comments.) |
|
You can preview 0832d58 at https://pr19795-0832d58.ngbuilds.io/. |
|
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |


AIO is currently using a beta version of @angular/service-worker.
Since that was implemented, the SW has been rewritten and released
as part of Angular 5.0.0. This commit updates AIO to use the latest
implementation, with an appropriate configuration file that caches
the various AIO assets in useful ways.