webpack-md5-hash
webpack-md5-hash copied to clipboard
Base the hash on the output rather than the input
This will have a problem too. If the inputs stay the same but the modules which package the output change then the hash will stay the same but the output may differ.
For example, i change none of my inputs but Uglify changes, resulting in different output but the same hash.
Why not solve all these problems by basing the hash on the output rather than the inputs?
Related: https://github.com/webpack/webpack/issues/4659
I don't think those are problems but rather design choices.
One example: hashed images are referenced in module output. When the image changes the output based hashing would cause the module hash to change which would change the bundle hash. In this case the end user's cached image would be busted (good) but the entire cached bundle would also be busted (not good).
To your example, technically if the uglified code is different, it's functionality should be identical, meaning the hash should remain the same. If you want protection against a potential uglification bug then it's recommended to change the underlying code at the same time.