Rspack persistent cache bug repro - #1
Closed
slorber wants to merge 2 commits into
Closed
Conversation
This was referenced Feb 20, 2025
Closed
This was referenced Mar 6, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Here's a bug repro that shows a case where Rspack persistent cache is less efficient than webpack cache.
When some app JS files are code generated with
fs.writeFile(), these files are always "re-loaded" by Rspack (but not by webpack) despite their content always being the same.Not covered by this repro, but this also happens for files using loader
this.addDependency("./dynamic.json"). I suspect the fs update time is used to invalidate cache entries, while webpack only uses the file content?On Docusaurus, we have many files like that being code-generated, from JS to MDX documents outputted by community plugins. It would be great for us to have better persistent caching support for this scenario, like webpack does.
The test script
yarn testwill output:As you can see, the
dynamicFile.js(code-generated) is always reloaded by Rspack, but not by webpack.