-
Notifications
You must be signed in to change notification settings - Fork 8
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
Different input files with the same content get cached to the same file #3
Comments
( 😨 Oh my goodness, I completely overlooked this issue, sorry for the late reply!) To your issue, i was conscious of the fact that two files would result in the same cache because for various transforms I used, it is actually okay to not-reprocess the same file even if it changed location. For example: module.exports = class MyClass {} in two different places could be transformed by plugins to a backwards-compatible: function MyClass() {}
module.exports = MyClass is okay to used the cached version as replacement for both. But you have an important point, there are transforms that very well could act differently depending on the location, as such it seems to me like it would be a good idea to have a flag that en/disables file-caching based based on location. (I tend to think that the default should be to use the file-path, so it would become an optimization option). |
Hey, rando popping in on the convo! Hope you don't mind. Ran into this situation today, but the cause for concern was that the resulting cache file was sometimes getting garbled. Not sure how file locks work with Does that sound like something you could see unintentionally happening in this package? |
@loklaan Probably should be a separate issue. Never tried to have parallel bundlers running 😅 |
My apologies, but my original issue wasn't very well written. The issue @loklaan describes is the issue I was trying to fix. The reason
is a problem is because simultaneous writes to the same cache file results in a garbled file. |
@josephwarrick Thank you for clarifying this! The broken indexes are indeed an issue. Took the time to look into it and thought #6 might be a good idea. |
If two different files have exactly the same content, they will both get cached to the same cache file.
This can happen most frequently when multiple packages require different versions of a given node_module. That is, foo requires [email protected], and baz requires [email protected], so the content of the file at "node_modules/foo/node_modules/bar/lib/thing.js" is the exact same as the content of the file at "node_modules/baz/node_modules/bar/lib/thing.js" even though they are different files.
The text was updated successfully, but these errors were encountered: