ember-cli / ember-cli/ember-cli-terser

Fingerprint does not update when content changed after webpack update

Open
#323 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
23
Forks
24
PR merge metrics
No merged PRs in 30d

Description

We had an incident after updating webpack. Turns out that the webpack update **changed the content** of `vendor-${fingerprint}.js` but **did not update** the `fingerprint`. We also use `ember-cli-sri` that adds integrity SHA in `index.html` which correctly updated. Users opening the site in a new tab got the new `index.html` with the right integrity SHA and the browsers served the old `vendor-1234.js` from cache. That resulted in the following error:

```
Failed to find a valid digest in the 'integrity' attribute for resource
'https://example.com/assets/vendor-1234.js' with computed SHA-512 integrity '03...Ugg=='.
The reosuce has been blocked.
```

Somehow the order seems to be wrong and the fingerprinting should run after webpack finished its work.

I first thought that renaming this addon from `ember-cli-uglify` to `ember-cli-terser` in https://github.com/ember-cli/ember-cli-terser/pull/230 caused it because `ember-cli-sri` still refers to `ember-cli-uglify` [here](https://github.com/jonathanKingston/ember-cli-sri/blob/11eb96db02b8b3b150cf68393d39a6e1192d845c/package.json#L57-L60). Then I saw that this addon has its own order infos [here](https://github.com/ember-cli/ember-cli-terser/blob/f3b5fd4875697c223fb1a9414c568c3aadbc017c/package.json#L57-L60) introduced in https://github.com/ember-cli/ember-cli-terser/pull/266.

If `broccoli-asset-rev` does the fingerprinting this addon should run `before` `broccoli-asset-rev` also mentioned in https://github.com/ember-cli/ember-cli-terser/pull/298

~~Is the only solution to fix this, to pin `ember-cli-terser` to `4.0.1`?~~

Edit: Pinning `ember-cli-terser` to `4.0.1` will not work because it's missing `"before": "ember-cli-sri",` 😞
Edit: I found the same issue for [ember-cli-autoprefixer](https://github.com/kimroen/ember-cli-autoprefixer/issues/38) with the expected [fix](https://github.com/kimroen/ember-cli-autoprefixer/pull/39).

@NullVoxPopuli @mike-engel

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.