Skip to content

Conversation

@chenjiahan
Copy link
Member

@chenjiahan chenjiahan commented Jun 24, 2025

Summary

Disable Rspack's config schema validation to improve performance.

Rsbuild has ensured that the built-in Rspack configuration is correct through TypeScript, so it is usually redundant to perform schema validation at runtime. Disabling schema validation can improve performance by 20ms to 30ms.

This can be manually enabled via RSPACK_CONFIG_VALIDATE=strict:

RSPACK_CONFIG_VALIDATE=strict rsbuild build

Related Links

See web-infra-dev/rspack#10768 for performance comparison.

Checklist

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

Copilot AI review requested due to automatic review settings June 24, 2025 07:36
@netlify
Copy link

netlify bot commented Jun 24, 2025

Deploy Preview for rsbuild ready!

Name Link
🔨 Latest commit ee9eed2
🔍 Latest deploy log https://app.netlify.com/projects/rsbuild/deploys/685a55931d89700008e47b6c
😎 Deploy Preview https://deploy-preview-5475--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: 87 (🟢 up 28 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.

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 disables Rspack's config schema validation by default to improve performance, while still allowing manual strict validation via an environment variable override.

  • In packages/core/src/plugins/basic.ts the default validation is changed to 'loose-silent' to disable runtime schema checks.
  • In e2e/playwright.config.ts strict validation is forced for test environments.
  • In e2e/cases/config/rspack-config-validate/index.test.ts tests are updated to temporarily set the validation mode for warning scenarios.

Reviewed Changes

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

File Description
packages/core/src/plugins/basic.ts Default config validation is disabled for performance gains.
e2e/playwright.config.ts Test environment explicitly enables strict config validation.
e2e/cases/config/rspack-config-validate/index.test.ts Tests adjusted to temporarily override validation mode.
Comments suppressed due to low confidence (2)

packages/core/src/plugins/basic.ts:98

  • [nitpick] The comment accurately explains the new default behavior, but consider adding a brief note that this behavior can be overridden in test environments to clarify the rationale for differing modes between production and testing.
        process.env.RSPACK_CONFIG_VALIDATE ||= 'loose-silent';

e2e/cases/config/rspack-config-validate/index.test.ts:26

  • [nitpick] The test temporarily sets RSPACK_CONFIG_VALIDATE to 'loose-unrecognized-keys' even though the production default has shifted to 'loose-silent'; consider adding a clarifying comment to explain why this override is necessary for the warning test scenario.
  const value = process.env.RSPACK_CONFIG_VALIDATE;

@chenjiahan chenjiahan merged commit 716f7ce into main Jun 24, 2025
13 checks passed
@chenjiahan chenjiahan deleted the rspack_validation_0624 branch June 24, 2025 07:48
@chenjiahan chenjiahan mentioned this pull request Jun 26, 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.

1 participant