Skip to content

Conversation

GiveMe-A-Name
Copy link
Member

@GiveMe-A-Name GiveMe-A-Name commented Aug 5, 2025

Summary

This PR enables lazy compilation by default in Rspack, making it an out-of-the-box optimization for better development experience without requiring explicit configuration.

🚀 Context & Motivation

This change aligns with the Rspack 1.5 Release Plan discussion (#10867), where lazy compilation was identified as a key feature for improving development experience. As mentioned in the discussion:

"Enable lazy compilation for dynamic imports by default" - planned for Rsbuild 1.5

Related links

Checklist

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

@Copilot Copilot AI review requested due to automatic review settings August 5, 2025 09:11
@GiveMe-A-Name GiveMe-A-Name requested a review from hardfist as a code owner August 5, 2025 09:11
Copy link

netlify bot commented Aug 5, 2025

Deploy Preview for rspack canceled.

Name Link
🔨 Latest commit 65ce628
🔍 Latest deploy log https://app.netlify.com/projects/rspack/deploys/6892c22e57ae000008de6946

@github-actions github-actions bot added the team The issue/pr is created by the member of Rspack. label Aug 5, 2025
Copy link
Contributor

@Copilot 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 enables lazy compilation by default in Rspack, changing the default value from false to true and setting up default configuration options for entries and imports when lazy compilation is enabled.

  • Updates default value for experiments.lazyCompilation from false to true
  • Configures default lazy compilation options with entries: true and imports: true
  • Updates documentation to reflect the new default value

Reviewed Changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
packages/rspack/src/config/defaults.ts Changes default lazy compilation from false to an object with entries and imports set to true
packages/rspack/src/config/types.ts Updates JSDoc comment to reflect new default value
website/docs/en/config/experiments.mdx Updates English documentation default value
website/docs/zh/config/experiments.mdx Updates Chinese documentation default value
packages/rspack-test-tools/tests/legacy-test/MultiCompiler.test.js Explicitly disables lazy compilation in test to maintain existing behavior
packages/rspack-test-tools/tests/snapshots/Defaults.test.js.snap Updates snapshot to reflect new default configuration

if (typeof experiments.lazyCompilation === "object") {
D(experiments.lazyCompilation, "entries", true);
D(experiments.lazyCompilation, "imports", true);
}
Copy link
Preview

Copilot AI Aug 5, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Setting an empty object as the default and then conditionally populating it creates unnecessary complexity. Consider directly setting the default object with the desired properties: D(experiments, "lazyCompilation", { entries: true, imports: true });

Suggested change
}
D(experiments, "lazyCompilation", { entries: true, imports: true });

Copilot uses AI. Check for mistakes.

Copy link
Member

@chenjiahan chenjiahan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor

github-actions bot commented Aug 5, 2025

📦 Binary Size-limit

Comparing 65ce628 to chore(deps): update github-actions (#11295) by renovate[bot]

🙈 Size remains the same at 50.36MB

Copy link

codspeed-hq bot commented Aug 5, 2025

CodSpeed Performance Report

Merging #11289 will not alter performance

Comparing chore/enable-lazy-compilation-by-default (65ce628) with main (4bc90bb)

Summary

✅ 17 untouched benchmarks

@GiveMe-A-Name GiveMe-A-Name marked this pull request as draft August 6, 2025 02:19
@GiveMe-A-Name GiveMe-A-Name changed the title chore: enable lazy-compilation by default tests: enable lazy-compilation Aug 6, 2025
@GiveMe-A-Name GiveMe-A-Name changed the title tests: enable lazy-compilation tests: enable lazy-compilation(no merge) Aug 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
team The issue/pr is created by the member of Rspack.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants