Skip to content

Conversation

@chenjiahan
Copy link
Member

Summary

Remove unnecessary path.extname(filePath) call to improve performance slightly.

Screenshot 2025-10-21 at 17 52 26

Checklist

  • Tests updated (or not required).
  • Documentation updated (or not required).

@chenjiahan chenjiahan requested a review from hardfist as a code owner October 21, 2025 09:55
Copilot AI review requested due to automatic review settings October 21, 2025 09:55
@netlify
Copy link

netlify bot commented Oct 21, 2025

Deploy Preview for rspack canceled.

Name Link
🔨 Latest commit 8a4e14e
🔍 Latest deploy log https://app.netlify.com/projects/rspack/deploys/68f9998657053700088242a3

@chenjiahan chenjiahan changed the title perf(rspack-cli): simplify esm file detection perf(cli): simplify ESM file detection Oct 21, 2025
@github-actions github-actions bot added release: performance release: performance related release(mr only) team The issue/pr is created by the member of Rspack. labels Oct 21, 2025
Copy link
Contributor

Copilot AI left a 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 isEsmFile to test full file paths directly instead of extracting extensions first
  • Removed unnecessary cwd parameter from isEsmFile and crossImport functions
  • Changed isEsmFile from 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.

@github-actions
Copy link
Contributor

github-actions bot commented Oct 21, 2025

📦 Binary Size-limit

Comparing 8a4e14e to chore(ci): fix flaky mf container-1-5 test cases (#11954) by pshu

🙈 Size remains the same at 47.82MB

@codspeed-hq
Copy link

codspeed-hq bot commented Oct 21, 2025

CodSpeed Performance Report

Merging #11946 will not alter performance

Comparing cli_is_esm_1021 (8a4e14e) with main (e28e40e)

Summary

✅ 17 untouched

@chenjiahan chenjiahan requested a review from 9aoy October 23, 2025 10:39
@chenjiahan chenjiahan merged commit 3e23e41 into main Oct 23, 2025
90 of 96 checks passed
@chenjiahan chenjiahan deleted the cli_is_esm_1021 branch October 23, 2025 11:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

release: performance release: performance related release(mr only) team The issue/pr is created by the member of Rspack.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants