-
-
Notifications
You must be signed in to change notification settings - Fork 388
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove LF, CRLF, CR from output to get a consistent [contenthash] #355
Comments
@peterhirn we already calculate |
Thank you for your response. I was looking at the output generate by |
I have a feeling i'm experiencing the same issue. We've got snapshots that keep failing due to changed CSS contenthashes, when the CSS rules in each file are exactly the same. What's weird is the hashes are the same when building on the same machine, but different when a new person clones the project down and does a build. Suggests contenthashes are changing on a machine by machine basis :/ |
@KingScooty yep, i think it is bug, anyway can you create minimum reproducible test repo to ensure problem in |
Investigation (include other bundlers):
All bundlers (list above) generate other hash ( So it is normal what Also i was wrong, it is not safe change line ending, it can potential break code. Also you usually use minimizer for production (for example If you still have difference Anyway feel free to open new issue, if you still have difference |
@evilebottnawi I think the issue wasn't really related to LF/CRLF/CR, there is another problem leading to inconsistent Since it basically gives a different hash depending on the root path (from what I understand) it is very likely to occur when building on different OS. |
@Lyrkan problem with source map, postcss generate absolute source map, so |
We're also having this issue. Same hash is generated on one machine, but the content hash keeps changing when a different developer does a webpack build and nothing has changed in the content. Then it stays the same for that developer, but changes again when another developer does a build. Any tips for working around this? @evilebottnawi you mention that this is a known issue, do you have an open issue number we can track, as this one is closed, so I'm assuming the known issue is known by a different id? |
fixed in webpack@5, can't be fixed in webpack@4 |
Thanks for the quick reply @evilebottnawi I just edited my reply to provide more context. We are actually running webpack 5. Some relevant version numbers below for what we are running if it helps:
|
Noticed theres a few new versions released, updated now to the following, but the issue is still present.
@evilebottnawi, could you provide more context around what was fixed as per your comment above? Thanks |
in production mode you will have |
@evilebottnawi I'm afraid I don't quite follow. Could you clarify? Thanks |
|
Thanks for the clarification. This is in production mode. The problem is as mentioned above, but I will go in more detail. However, if we now commit all this to git, and another developer pulls this, and does a build. Something else happens. The content hash on the .css file names change when a different developer does a webpack build and nothing has changed in the content. Then it stays the same for that developer, but changes again when another developer does a build. This is what git shows has changed, even though no code has changed prior to running the build command on the second machine. Both source and sourcemap hash change. Does that help clarify it, and is that the same as the original issue in this thread, or would you like me to create another issue on github? Thanks |
Interesting, can you create reproducible test repo, do you use latest |
Yes, all the latest as per the ones I listed above
Bit tricky on a test repo, dont really know how to separate everything from ours. |
Without source maps hashes are same on different computers? |
Hmm, thats one I have yet to try, will try that now |
I did it locally and ofcourse the hashes change, as the contents now has no reference to a sourcemap. We do need sourcemaps either way, although I agree its a good thing to rule out. |
yes, I want to found the problem to focus on fixing |
We have come across line ending issues before, but seeing as this is CSS that is pulled into the JS, minified, and then extracted out again by your plugin, I dont see how line endings can come into it, as it would be lines generated by webpack/plugins. One machine is on Mac (mine), and the other Linux. Will have to wait a couple more hours to test on the other machine. |
yep, i think you faced with out problem
Feel free to ping me |
@evilebottnawi they just came online and we did the test with no sourcemaps, error still occurs. The files are binary equal:
Yet something is still changing the hash, even though contents are identical. Thus can't be line endings either. |
need to look at plugins, maybe some change something, we have tests on this case and it is success on windows/macos/linux, can you show diff without source maps? |
The diff shows no difference between the files. As confirmed by the sha checksum being the same. The route the css takes with regards to plugins: |
Do you use |
Yes |
Weird, hard to say why it happens, do you use sass/less/postcss? |
We dont use any of those, the build process is literally We can also use Gitter chat to discuss if thats quicker/easier? |
Let's use twitter https://twitter.com/evilebottnawi, feel free to DM, but I think without reproducible test repo I can'y help 😞 |
Maybe edge case |
Plugin creates identical output files with different contenthash-values when input is LF vs CRLF.
I think the content-hash should be calculated based on the output?
The text was updated successfully, but these errors were encountered: