webpack-chunk-hash
Advanced tools
Comparing version 0.3.0 to 0.4.0
@@ -11,2 +11,3 @@ var crypto = require('crypto'); | ||
this.digest = options.digest || 'hex'; | ||
this.additionalHashContent = options.additionalHashContent || function() { return ''; }; | ||
} | ||
@@ -23,3 +24,3 @@ | ||
var source = chunk.modules.map(getModuleSource).sort(sortById).reduce(concatenateSource, '') | ||
, hash = crypto.createHash(_plugin.algorithm).update(source) | ||
, hash = crypto.createHash(_plugin.algorithm).update(source + _plugin.additionalHashContent(chunk)) | ||
; | ||
@@ -26,0 +27,0 @@ |
{ | ||
"name": "webpack-chunk-hash", | ||
"version": "0.3.0", | ||
"version": "0.4.0", | ||
"description": "Plugin to replace a standard webpack chunk hashing with custom (md5) one.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -37,4 +37,15 @@ # webpack-chunk-hash | ||
## Options | ||
``` | ||
// a callback to add more content to the resulting hash | ||
additionalHashContent: function(chunk) { return 'your additional content to hash'; } | ||
// which algorithm to use (https://nodejs.org/api/crypto.html#crypto_crypto_createhash_algorithm) | ||
algorithm: 'md5' | ||
// which digest to use (https://nodejs.org/api/crypto.html#crypto_hash_digest_encoding) | ||
digest: 'hex' | ||
``` | ||
## License | ||
WebpackChunkHash plugin is released under the [MIT](License) license. |
4328
43
51