Repository navigation
Conversation
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.
This is a follow-up of v1 repro here: #1
This time, we are executing one
compiler.run()call per CLI invocation(instead of calling
compiler.run()multiple times in a single Node CLI script execution)So technically, the Node script now just does a bundler compilation, and nothing else.
Let's consider this scenario:
Webpack behavior
As expected the first compilation is slow:
However the 2nd compilation is fast, because
dynamicFile.jscontent didn't change:On 3rd compilation, the content of the file changed, so only that file recompiles, as expected:
Rspack behavior
As expected the first compilation is slow:
The 2nd compilation is faster, but⚠️ not as fast as webpack.
dynamicFile.jsrecompiles because the file what "rewritten", even if it's the exact same content.On 3rd compilation, the content of the file changed, so only that file recompiles, as expected:
How to fix that?
On the 2nd CLI run, I'd like the Rspack compilation to be as fast as the Webpack one.
The constraints I have:
Considering this is possible with Webpack, I assume it should also be possible to solve this for Rspack.
I can eventually pass extra
compiler.run()methods likemodifiedFiles, but to be honest I have no idea what values to provide in these options, and a concrete example would be useful.Quoting your comment: web-infra-dev/rspack#9413 (comment)
I understand that Rspack might prefer to not hash all file content by default for performance reasons. At the same time, if I have to do it myself in userland, this is really unergonomic because the dynamic files of the previous compilation are not persisted in my scenario: each CLI call is a different CI run.
Providing myself an exhaustive
modifiedFilesattribute to Rspack means that I would need to build my own persistent cache system on top of the existing Rspack persistent cache. This would be much simpler if it was built-in directly into Rspack, exactly like Webpack does.I don't mind if the calculation of hashes is an opt-in boolean option, and accept the perf tradeoff.
If it's possible to provide that configuration option, I think that would be super useful to us.
This way, we can probably use
modifiedFilesin dev (when using watchers) to improve perf by not computing file hashesDoes it make sense?
If you can edit my Node.js script in a way that makes the 2nd Rspack compilation fast like Webpack (not recompiling
dynamicFile.js), then the problem would be solved. Do you see any solution I don't see?Thanks