Skip to content

Service Worker with Critical lib #25267

@fabienbranchel

Description

@fabienbranchel

I'm submitting a...


[ ] Regression (a behavior that used to work and stopped working in a new release)
[x] Bug report  
[ ] Performance issue
[ ] Feature request
[ ] Documentation issue or request
[ ] Support request => Please do not submit support request here, instead see https://github.com/angular/angular/blob/master/CONTRIBUTING.md#question
[ ] Other... Please describe:

Current behavior

I use the Critical lib. When I use it, it's break the Angular Service Worker.

When using Critical, this is logs from Network panel :

capture d ecran 2018-08-02 a 15 41 44

When not using Critical, this is logs from Network panel :

capture d ecran 2018-08-02 a 15 40 07

As you may know, Critical handle the CSS. The script I use is just replace some CSS relative lines in my index.html. When using it, it's like preventing the SW to do all his work.

The issue is when we go offline, the refresh doesn't work, nothings seems to be cached by the SW.

Expected behavior

Using Critical and SW is ok with that.

Minimal reproduction of the problem with instructions

You can use this repo :
https://github.com/fabienbranchel/angular-sw-critical-css

In order to have this issue, you can use this following command (make an app build prod and apply Critical script) :

npm run branchel-prod-critical

In order to have the classic behavior, you can use this following command (make an app build prod) :

 npm run branchel-prod

What is the motivation / use case for changing the behavior?

Working stuff. :-)

Environment


Angular version: 6.1.0

Browser:
- [X] Chrome (desktop) version 68.0.3440.84 (64 bits)
- [X] Chrome (Android) version 67.0.3396.87

 
For Tooling issues:
- Node version: 10.6.0
- Platform:  macOS 10.13.6, Android 8.0.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: service-workerIssues related to the @angular/service-worker package

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions