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
Possible breaking change in minor version, sudden rename of chunk filenames #3060
Comments
I'm noticing this as well. It looks like there are two problems here:
Regarding (1), I believe this is a bug not a breaking change and it definitely needs to be fixed or reverted. If the chunk hashing is not taking into consideration the content as well as the filenames of all dependencies, that's going to cause bugs like the one described here -- not just in cases where Rollup changes the naming, but even in cases where users switching their naming scheme. I wrote about a similar issue in #2839. Regarding (2), I believe this should be considered a breaking change (it broke my build code), because any build logic that was expecting the name of non-manually-generated chunks to always be In my particular case, I was creating an asset map JSON file of chunk names to full filenames (including the hash), so that in my templates I could create The problem introduced by this name change is now I can have multiple chunks with the same name, and I don't have control over that naming at all -- which means dynamically generated chunks were overriding my entry chunks in my asset manifest. Given that (2) broke my code and (1) is clearly problematic, would it make sense to revert to the old behavior until a better solution is found? |
I definitely agree that not taking the pattern itself or the
As for the name changing, I agree that this may be inconvenient for you but as I see it, there was never a strict rule that auto-generated chunks have their My suggestion if you rely on the name As for the manifest file, not sure I completely understand your scenario but in the bundle object, you also have the information available if a file is an entry point, maybe this would help you? |
This was the reason I considered it "breaking". It was documented to do X and then it stopped doing X and started doing Y from 1.8 to 1.9. I do understand though that documentation isn't always correct (I've certainly written my share of incorrect docs), so I guess I don't necessarily consider all deviations from documentation breaking... Anyway, in terms of this feature, one thing that would be helpful for my particular use case here is the ability to distinguish between chunks created via the While I can solve my particular issue in a variety of ways, my preference would be to not have two files in the same directory that only differ in their hash (e.g. If @jakearchibald's original suggestion of using a function is possible, that would be my preference. {
chunkFileName: (chunkInfo: ChunkInfo) => string
} I guess that would require adding some additional info to the |
Fix for the original issue at #3083 |
How Do We Reproduce?
npm install
npx rollup -c
npm install
npx rollup -c
The first doc1-df1a6f13.js (also cached for a long time) imports chunk-1620c961.js. The new doc1-df1a6f13.js import exports-a-function-1620c961.js. Because the first doc1 is cached for a long time, the second one is never loaded in the browser, due to server side caching.
Expected Behavior
When file name changes of imported files, i would expect that the hash in the filename changes.
Actual Behavior
There can be 2 files with different content (the imports differ) with the same hash, causing server to cache a file with an import to a non existent file.
The text was updated successfully, but these errors were encountered: