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
Further improvements to performance of hash regex lookups in RealContentHashPlugin #16791
Comments
@ryanwilsonperkin Feel free to experiment with it, v8 optimizes some regular expressions so we really need to make sure we will have better perf 👍 |
When using |
@dmichon-msft Sounds good idea, but I am afraid it will require to rewrite some plugin outside of webpack ecosystem |
@dmichon-msft thats not possible.. the hole idea is that you can plug-in/plug-out plugins.. |
With an appropriate hook in content hash generation, RealContentHashPlugin could override the original content hash generation to account for that it is going to get completely replaced. Alternatively, it could become a standard step in the webpack process that content hashes start as a marker and get replaced during a later hook (that other plugins can tap into). I've used the token-then-replace model in a few plugins to-date because it stabilizes output and makes, e.g. minification more cacheable. Equally relevant to optimizing this scenario is that the full list of referenced hashes in a given asset comes from the code generation process; we ought to be able to annotate the asset info with which hashes were injected into the asset at the moment they are being injected, without having to do a RegExp search through the final code. |
This issue had no activity for at least three months. It's subject to automatic issue closing if there is no activity in the next 15 days. |
bump |
can this solve the hash conflict problem in realContentHash, we have internal projects have code contains the hash of chunk id and accidentlly wrongly replaced |
@hardfist We can try, but there is a limitation - if a plugin take asset and try to parse, it can be failed, I still think how better to fix it... |
Issue was closed because of inactivity. If you think this is still a valid issue, please file a new issue with additional information. |
Feature request
Continuing idea for improvements carried over from #16759 (comment)
What is the expected behavior?
Calculation of whether or not a hash has matched can be reused in our logic for performing hash replacements
Per @alexander-akait (source):
What is motivation or use case for adding/changing the behavior?
Performance speed of RealContentHashPlugin
How should this be implemented in your opinion?
Are you willing to work on this yourself?
yes
The text was updated successfully, but these errors were encountered: