Mini-css-extract-plugin: Content hash support

Created on 4 Mar 2018  路  10Comments  路  Source: webpack-contrib/mini-css-extract-plugin

Using [email protected]

Is it possible to support a content hash in the filename, like extract-text-webpack-plugin's [contenthash]?

Using filename: '[name].[chunkhash:8].css' the .css hash is also changing when only the JavaScript in the chunk has changed:

conemu64_2018-03-04_21-35-20

conemu64_2018-03-04_21-42-07

Most helpful comment

The impl has finished. CSS module test has also been added. Just waiting for webpack 4.3.0 release with contenthash support to send a PR.

https://github.com/webpack-contrib/mini-css-extract-plugin/tree/feature/contenthash

All 10 comments

Needs to be added! There were some issues with Cache Busting not working.
contentHash helps there!

FYI. From slack:

sokra [3:19 PM]
I'll take care of `[contenthash]` this week. It will be added to webpack core, because it is also needed for JS files in combination with CSS or WASM files.

It is not necessary to implement this here :star: Just wait next release webpack@4

/cc @michael-ciniawsky what do you think, better wait webpack release?

Shouldn't the chunk hash include the contents of the CSS sources, just as it does for the JS sources?

That's what the chunk hash does, yes. This is the content hash for the individual asset.

Yes; but the CSSModule defined by this plugin doesn't update the chunk hash鈥攊t just relies on the updateHash implementation in Module.

Perhaps that should be treated as a separate issue?

The impl has finished. CSS module test has also been added. Just waiting for webpack 4.3.0 release with contenthash support to send a PR.

https://github.com/webpack-contrib/mini-css-extract-plugin/tree/feature/contenthash

@sokra thanks, this is awesome! Webpack 4.3.0 has just been released.

This should work now.

Sorry, my mistake. #59 has to land first.

Was this page helpful?
0 / 5 - 0 ratings