Open whatadewitt opened 5 years ago
Reproduced just like you said; renaming the directory causes the hashes to change.
Related: https://github.com/webpack/webpack/issues/8419.
Sounds like they are reworking their hashing system for webpack 5.0 that could possibly fix this.
It looks like this has been fixed in webpack 5. We're currently working on upgrading to webpack 5 so this will be fixed then. See #9994.
Is this a bug report?
Yes
Did you try recovering your dependencies?
Yes
Which terms did you search for in User Guide?
Deployment, static files, hosting
Environment
Steps to Reproduce
Expected Behavior
Based on the docs, I would expect the "contenthash" values on both of my builds to be the same for my main.js, main.css and chunk.js files.
Actual Behavior
On the 2 different boxes, my app builds successfully, but the hashnames are totally different.
I know this is happening because CodePipeline is bringing my code into a directory that they are creating dynamically. The "hash" is based on the directory that the code is built in.
Reproducible Demo
Clone the CRA base into a local working directory (./cra1 as an example). Clone it again into another local working directory (./cra2 as an example).
Run
npm run build
on both folders.Note the "compiled" filenames are different but their content is the same.