-
-
Notifications
You must be signed in to change notification settings - Fork 746
perf: move crypto imports to lazy require calls #11930
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
Conversation
✅ Deploy Preview for rspack canceled.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR improves startup performance by moving Node.js crypto module imports from top-level imports to lazy require calls within functions, deferring module loading until the crypto functionality is actually needed.
Key changes:
- Removed top-level crypto imports in favor of function-scoped require calls
- Applied this optimization to both hash creation utilities and subresource integrity functionality
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| packages/rspack/src/util/createHash.ts | Replaced top-level crypto import with lazy requires in hash creation functions |
| packages/rspack/src/builtin-plugin/SubresourceIntegrityPlugin.ts | Moved crypto import from module level to function scope in computeIntegrity |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
📦 Binary Size-limit
🙈 Size remains the same at 47.73MB |
CodSpeed Performance ReportMerging #11930 will not alter performanceComparing Summary
|
Summary
Move crypto imports from top-level to lazy require calls within functions to improve start up performance by deferring module loading until needed.
Checklist