Chunk hash are not consistent on different machines

When requiring shim for using process in browser, chunk hash variants on different machines.
In the module “lib/NodeSourcePlugin”, “getPathToModule” method will return an absolute path of node shim. This will cause different results depending on the path where your project exits on different machines. And when webpack injects variable dependencies such as ‘require(/path/to/node_modules/process/browser.js)’, the expression used to initialize DependenciesBlockVariable is changed, Which makes the hash of chunk changed too !
Is this a bug ? Or feature ? It is so disturbing that same code but gets different hash.

Author: Fantashit

6 thoughts on “Chunk hash are not consistent on different machines

  1. Using Webpack 3.6 I get different hashes when using CSS modules. When I build with the same config but without the components using CSS modules the hashes match across machines. This could mean a problem remains in the css-loader (or sass-loader etc.) rather than Webpack itself. I’ll create a repo where this can easily be reproduced and a new issue, but thought it might be worth mentioning here.

  2. We met the issue with different chankhash names on different machines. It’s a big problem to reproduce it, because we face this issue on a huge amount of files and there is no any obvious way to reproduce it. Sometimes it happens, sometimes does not. looks like webpack-md5-hash is not a silver bullet also because it has its own issues and also looks abandoned.

  3. @dmitry @aguynamedben @thecalvinchan @lcxfs1991

    Hey guys! I’ve made an example of this issue. Me and my colleges checked it already on many machines and all of us got different hashes.

    My example uses a one of real examples with using expose-loader, but actually expose-loader is not a cause of this issue. It’s just a one way of many to reproduce it; But I hope it is already a good test case to start investigation.

    Could you guys check it and let me know about your results?

    @sokra could we create a ticket for this issue? It’s really important because it affects production servers. It’s very unpleasant case when a few front-end servers have different chunkhash names and users can’t reach them only randomly though a load balancer.

Comments are closed.