-
-
Notifications
You must be signed in to change notification settings - Fork 746
perf(cli): simplify ESM file detection #11946
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 simplifies ESM file detection in rspack-cli by removing unnecessary path.extname() calls and refactoring the isEsmFile function. The optimization directly tests file paths against regex patterns instead of first extracting the extension, improving performance while maintaining the same functionality.
Key changes:
- Refactored
isEsmFileto test full file paths directly instead of extracting extensions first - Removed unnecessary
cwdparameter fromisEsmFileandcrossImportfunctions - Changed
isEsmFilefrom default export to named export
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| packages/rspack-cli/src/utils/isEsmFile.ts | Simplified ESM detection by testing full paths and removed unused cwd parameter |
| packages/rspack-cli/src/utils/crossImport.ts | Updated to use named import and removed cwd parameter |
| packages/rspack-cli/src/utils/loadConfig.ts | Updated import statement and removed cwd arguments from crossImport calls |
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.82MB |
CodSpeed Performance ReportMerging #11946 will not alter performanceComparing Summary
|
Summary
Remove unnecessary
path.extname(filePath)call to improve performance slightly.Checklist