Skip to content

perf: enable Rspack's barrel file optimization by default#5840

Merged
chenjiahan merged 1 commit intomainfrom
lazy_barrel_0814
Aug 14, 2025
Merged

perf: enable Rspack's barrel file optimization by default#5840
chenjiahan merged 1 commit intomainfrom
lazy_barrel_0814

Conversation

@chenjiahan
Copy link
Copy Markdown
Member

@chenjiahan chenjiahan commented Aug 14, 2025

Summary

Enable Rspack's experimental barrel file optimization by default.

When building applications with barrel files, this optimization should make builds significantly faster.

# Without barrel optimization
Benchmark 1: node --run build:rsbuild
  Time (mean ± σ):      1.708 s ±  0.040 s    [User: 4.624 s, System: 2.005 s]
  Range (min … max):    1.655 s …  1.757 s    5 runs

# With barrel optimization
Benchmark 2: BARREL=true node --run build:rsbuild
  Time (mean ± σ):      1.253 s ±  0.007 s    [User: 3.179 s, System: 1.292 s]
  Range (min … max):    1.240 s …  1.258 s    5 runs

Summary
  BARREL=true node --run build:rsbuild ran
    1.36 ± 0.03 times faster than node --run build:rsbuild

This optimization can be disabled via experiments.lazyBarrel:

// rsbuild.config.mjs
export default {
  tools: {
    rspack: {
      experiments: {
        lazyBarrel: false,
      },
    },
  },
};

Related Links

Checklist

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

Copilot AI review requested due to automatic review settings August 14, 2025 03:37
Copy link
Copy Markdown
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

Enable Rspack's experimental barrel file optimization by default to improve build performance for applications using barrel files. This optimization is enabled by setting lazyBarrel: true in the experiments configuration.

Key Changes

  • Added lazyBarrel: true to the default Rspack experiments configuration in the basic plugin
  • Updated test snapshots to reflect the new configuration option

Reviewed Changes

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

Show a summary per file
File Description
packages/core/src/plugins/basic.ts Added lazyBarrel experiment configuration
packages/core/tests/snapshots/environments.test.ts.snap Updated test snapshots for environment configurations
packages/core/tests/snapshots/default.test.ts.snap Updated test snapshots for default plugin configurations
packages/core/tests/snapshots/builder.test.ts.snap Updated test snapshots for builder configurations
packages/core/tests/snapshots/basic.test.ts.snap Updated test snapshots for basic plugin configurations

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

@netlify
Copy link
Copy Markdown

netlify bot commented Aug 14, 2025

Deploy Preview for rsbuild ready!

Name Link
🔨 Latest commit 9cd3639
🔍 Latest deploy log https://app.netlify.com/projects/rsbuild/deploys/689d59f3c216b00008519711
😎 Deploy Preview https://deploy-preview-5840--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: 71 (🟢 up 3 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.

@chenjiahan chenjiahan merged commit 29cb2a3 into main Aug 14, 2025
12 checks passed
@chenjiahan chenjiahan deleted the lazy_barrel_0814 branch August 14, 2025 03:43
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