brunocodutra/webapp-webpack-plugin

Add hash to files name

Closed this issue · 4 comments

Is it or would it be possible to add hash to files name ?

I found a workaround of using prefix: '[hash]' but this use the hash of the logo file for everything, changing a manifest value without the logo won't change be updated.

Interesting point, I guess I the cleanest solution would be to find a way to get [hash] to depend on the configuration object as well.

@ghetolay a fix was released in v2.0.1 to have [hash] depend on manifest metadata, so changing the plugin's config should imply a new prefix path if it contains [hash].

Please let me know if it works for you.

Damn that was fast :)

I can confirm hash is now updated with the config.

Just wondering why do you use message-pack and not webpack built-in hash generation (per file content) ?

@ghetolay message pack is not hashing anything, it's just a handy way to produce a Buffer from the contents of the input icon plus the metadata provided under the favicons configuration key, from which webpack ultimately produces the hash.

To answer the second part of your question, we don't hash each filename individually, because generally cache busting is not much of a concern for webapps, since service workers make sure assets are downloaded to the browser, even if their URL remains the same (see serviceworker-webpack-plugin).