Skip to content

perf: reduce stats.hasErrors() calls - #6305

Merged
chenjiahan merged 1 commit into
mainfrom
reduce_has_errors_1004
Oct 4, 2025
Merged

perf: reduce stats.hasErrors() calls#6305
chenjiahan merged 1 commit into
mainfrom
reduce_has_errors_1004

Conversation

@chenjiahan

Copy link
Copy Markdown
Member

Summary

Use context.buildState.hasErrors instead of stats.hasErrors(), which will reduce the overhead slightly.

Checklist

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

Copilot AI review requested due to automatic review settings October 4, 2025 13:39
@netlify

netlify Bot commented Oct 4, 2025

Copy link
Copy Markdown

Deploy Preview for rsbuild ready!

Name Link
🔨 Latest commit 5dcbf90
🔍 Latest deploy log https://app.netlify.com/projects/rsbuild/deploys/68e1238f7eeccc00081224bc
😎 Deploy Preview https://deploy-preview-6305--rsbuild.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
Lighthouse
Lighthouse
1 paths audited
Performance: 65 (🔴 down 4 from production)
Accessibility: 97 (no change from production)
Best Practices: 100 (no change from production)
SEO: 100 (no change from production)
PWA: 60 (no change from production)
View the detailed breakdown and full score reports

To edit notification comments on pull requests, go to your Netlify project configuration.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 optimizes build performance by replacing stats.hasErrors() method calls with direct access to context.buildState.hasErrors property, reducing overhead during build error checking.

  • Replaced stats.hasErrors() calls with context.buildState.hasErrors across build providers
  • Updated pluginFileSize to accept InternalContext parameter for accessing build state
  • Modified plugin initialization to pass context to pluginFileSize

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.

File Description
packages/core/src/provider/build.ts Replaced stats method call with direct build state access
packages/core/src/plugins/fileSize.ts Updated plugin to accept context parameter and use build state
packages/core/src/createRsbuild.ts Modified plugin initialization to pass context
packages/compat/webpack/src/build.ts Replaced stats method call with direct build state access

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@chenjiahan
chenjiahan merged commit 5abb25b into main Oct 4, 2025
12 checks passed
@chenjiahan
chenjiahan deleted the reduce_has_errors_1004 branch October 4, 2025 15:12
@chenjiahan chenjiahan mentioned this pull request Oct 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants