This repository can be used to check if and under what circumstances webpack may produce different hashes. See https://github.com/webpack/webpack/issues/1479
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
.gitignore
README.md
a.js
b.js
package.json
webpack.config.js

README.md

webpack-hash-test

This repository can be used to check if and under what circumstances webpack may produce different hashes. See https://github.com/webpack/webpack/issues/1479

Disclaimer

Hashes may change between different npm installations. This is because npm's installation is non-deterministic. In order to expect the same hashes, you need to ensure that all loaders and plugins stay unchanged. This is because loaders and plugins generate code. If they change the generated code, the hashes must also change.

Findings

1. Hashes DO change if a filename changes

Screenshot of terminal

This is surprising since the final bundle does not contain any information about filenames (no output.filename). (If you enabled output.filename, this is another cause for changing hashes).

2. Hashes DO NOT change if the path outside webpack's context change

Screenshot of terminal

3. Hashes are different on a different OS

Screenshot of terminal

As you can see, the hash on the Windows machine is different than the hash on MacOS. This is a logical consequence of 1) since Windows uses backslashes as path separator. It's probably also due to the fact that Windows uses CRLF for new lines.