Skip to content

Comments

test(lazy-barrel): enable tests and add treeshake-behavior cases#8071

Merged
shulaoda merged 1 commit intomainfrom
01-27-test_lazy-barrel_enable_tests_and_add_treeshake-behavior_cases
Jan 27, 2026
Merged

test(lazy-barrel): enable tests and add treeshake-behavior cases#8071
shulaoda merged 1 commit intomainfrom
01-27-test_lazy-barrel_enable_tests_and_add_treeshake-behavior_cases

Conversation

@shulaoda
Copy link
Member

No description provided.

Copy link
Member Author

shulaoda commented Jan 27, 2026


How to use the Graphite Merge Queue

Add the label graphite: merge-when-ready to this PR to add it to the merge queue.

You must have a Graphite account in order to use the merge queue. Sign up using this link.

An organization admin has enabled the Graphite Merge Queue in this repository.

Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue.

This stack of pull requests is managed by Graphite. Learn more about stacking.

@shulaoda shulaoda force-pushed the 01-27-test_lazy-barrel_enable_tests_and_add_treeshake-behavior_cases branch from 932c2fa to 75bbd7e Compare January 27, 2026 01:01
@shulaoda shulaoda force-pushed the 01-27-refactor_lazy-barrel_restructure_lazy_barrel_implementation branch from f7948d0 to 691421f Compare January 27, 2026 01:01
@shulaoda shulaoda changed the base branch from 01-27-refactor_lazy-barrel_restructure_lazy_barrel_implementation to graphite-base/8071 January 27, 2026 01:02
@shulaoda shulaoda force-pushed the 01-27-test_lazy-barrel_enable_tests_and_add_treeshake-behavior_cases branch from 75bbd7e to e096ada Compare January 27, 2026 01:04
@shulaoda shulaoda changed the base branch from graphite-base/8071 to 01-27-refactor_lazy-barrel_restructure_lazy_barrel_implementation January 27, 2026 01:04
@shulaoda shulaoda marked this pull request as ready for review January 27, 2026 01:05
Copy link
Member

@sapphi-red sapphi-red left a comment

Choose a reason for hiding this comment

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

LGTM
Would you add some test cases using sideEffects field in a separate PR?

@shulaoda
Copy link
Member Author

LGTM Would you add some test cases using sideEffects field in a separate PR?

Okay, I will do it in this PR stack.

@shulaoda shulaoda force-pushed the 01-27-test_lazy-barrel_enable_tests_and_add_treeshake-behavior_cases branch from e096ada to ecafa43 Compare January 27, 2026 05:41
@shulaoda shulaoda force-pushed the 01-27-refactor_lazy-barrel_restructure_lazy_barrel_implementation branch from 99ecbc4 to 86a3648 Compare January 27, 2026 05:41
@shulaoda shulaoda changed the base branch from 01-27-refactor_lazy-barrel_restructure_lazy_barrel_implementation to graphite-base/8071 January 27, 2026 05:47
@graphite-app
Copy link
Contributor

graphite-app bot commented Jan 27, 2026

Merge activity

  • Jan 27, 6:15 AM UTC: This pull request can not be added to the Graphite merge queue. Please try rebasing and resubmitting to merge when ready.
  • Jan 27, 6:16 AM UTC: Graphite disabled "merge when ready" on this PR due to: a merge conflict with the target branch; resolve the conflict and try again..
  • Jan 27, 6:16 AM UTC: The merge label 'graphite: merge-when-ready' was detected. This PR will be added to the Graphite merge queue once it meets the requirements.
  • Jan 27, 6:17 AM UTC: This pull request can not be added to the Graphite merge queue. Please try rebasing and resubmitting to merge when ready.
  • Jan 27, 6:17 AM UTC: Graphite disabled "merge when ready" on this PR due to: a merge conflict with the target branch; resolve the conflict and try again..
  • Jan 27, 6:17 AM UTC: The merge label 'graphite: merge-when-ready' was detected. This PR will be added to the Graphite merge queue once it meets the requirements.
  • Jan 27, 7:51 AM UTC: The merge label 'graphite: merge-when-ready' was detected. This PR will be added to the Graphite merge queue once it meets the requirements.
  • Jan 27, 7:58 AM UTC: The merge label 'graphite: merge-when-ready' was detected. This PR will be added to the Graphite merge queue once it meets the requirements.

@shulaoda shulaoda changed the base branch from graphite-base/8071 to main January 27, 2026 07:56
Copilot AI review requested due to automatic review settings January 27, 2026 07:57
@shulaoda shulaoda force-pushed the 01-27-test_lazy-barrel_enable_tests_and_add_treeshake-behavior_cases branch from ecafa43 to efa8e1e Compare January 27, 2026 07:57
@shulaoda shulaoda merged commit 5ecc11b into main Jan 27, 2026
25 of 26 checks passed
@shulaoda shulaoda deleted the 01-27-test_lazy-barrel_enable_tests_and_add_treeshake-behavior_cases branch January 27, 2026 07:57
@netlify
Copy link

netlify bot commented Jan 27, 2026

Deploy Preview for rolldown-rs ready!

Name Link
🔨 Latest commit efa8e1e
🔍 Latest deploy log https://app.netlify.com/projects/rolldown-rs/deploys/69786fd83096a9000809fd71
😎 Deploy Preview https://deploy-preview-8071--rolldown-rs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

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 enables previously skipped lazy-barrel tests and adds comprehensive treeshake-behavior test cases to validate the lazy-barrel optimization feature under various scenarios.

Changes:

  • Enabled 8 previously skipped lazy-barrel tests by removing skip: true and uncommenting the experimental.lazyBarrel configuration
  • Updated test expectations and comments in the unused-barrel-import and self-re-export tests to reflect correct lazy-barrel behavior
  • Fixed a typo in self-re-export test fixture where b was incorrectly assigned the value 'a' instead of 'b'
  • Added 3 new treeshake-behavior test cases (case-reexport, case-own-export, case-import-export) with shared barrel fixtures to comprehensively test lazy-barrel with various module side-effect configurations

Reviewed changes

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

Show a summary per file
File Description
packages/rolldown/tests/fixtures/lazy-barrel/unused-barrel-import/main.js New entry point for testing side-effect-only barrel imports
packages/rolldown/tests/fixtures/lazy-barrel/unused-barrel-import/barrel/index.js Added own export c to barrel to distinguish from re-exported c from c.js
packages/rolldown/tests/fixtures/lazy-barrel/unused-barrel-import/barrel/c.js New fixture file that exports c (re-exported by b.js but not loaded)
packages/rolldown/tests/fixtures/lazy-barrel/unused-barrel-import/barrel/b.js New fixture with re-export of c to test that unused re-export chains aren't loaded
packages/rolldown/tests/fixtures/lazy-barrel/unused-barrel-import/barrel/a.js New fixture exporting a
packages/rolldown/tests/fixtures/lazy-barrel/unused-barrel-import/_config.ts Enabled test, updated expectations to verify only main.js and barrel/index.js are loaded
packages/rolldown/tests/fixtures/lazy-barrel/treeshake-behavior/case-reexport/main.js Entry point testing re-export pattern where only requested export's dependency is loaded
packages/rolldown/tests/fixtures/lazy-barrel/treeshake-behavior/case-reexport/_config.ts Test config verifying lazy-barrel loads only necessary files for re-exported bindings
packages/rolldown/tests/fixtures/lazy-barrel/treeshake-behavior/case-own-export/main.js Entry point testing barrel's own export requiring full barrel execution
packages/rolldown/tests/fixtures/lazy-barrel/treeshake-behavior/case-own-export/_config.ts Test config verifying all barrel imports are loaded when barrel must execute
packages/rolldown/tests/fixtures/lazy-barrel/treeshake-behavior/case-import-export/main.js Entry point testing import-then-export pattern
packages/rolldown/tests/fixtures/lazy-barrel/treeshake-behavior/case-import-export/_config.ts Test config verifying module execution triggers loading of all import records
packages/rolldown/tests/fixtures/lazy-barrel/treeshake-behavior/barrel/index.js Shared barrel fixture with multiple import/export patterns for comprehensive testing
packages/rolldown/tests/fixtures/lazy-barrel/treeshake-behavior/barrel/gg.js Simple export used by g.js re-export
packages/rolldown/tests/fixtures/lazy-barrel/treeshake-behavior/barrel/g.js Pure re-export barrel for testing nested re-export resolution
packages/rolldown/tests/fixtures/lazy-barrel/treeshake-behavior/barrel/f.js Side-effect-only module (no exports)
packages/rolldown/tests/fixtures/lazy-barrel/treeshake-behavior/barrel/e.js Side-effect-only module (no exports)
packages/rolldown/tests/fixtures/lazy-barrel/treeshake-behavior/barrel/dd.js Module with own export and side effects, re-exported by d.js
packages/rolldown/tests/fixtures/lazy-barrel/treeshake-behavior/barrel/d.js Module with own export and re-export, marked as no side effects
packages/rolldown/tests/fixtures/lazy-barrel/treeshake-behavior/barrel/c.js Simple export with side effects, marked as no side effects via config
packages/rolldown/tests/fixtures/lazy-barrel/treeshake-behavior/barrel/b.js Simple export with side effects
packages/rolldown/tests/fixtures/lazy-barrel/treeshake-behavior/barrel/a.js Simple export with side effects
packages/rolldown/tests/fixtures/lazy-barrel/star-export/_config.ts Enabled test by removing skip flag and uncommenting lazyBarrel config
packages/rolldown/tests/fixtures/lazy-barrel/star-export-with-named/_config.ts Enabled test by removing skip flag and uncommenting lazyBarrel config
packages/rolldown/tests/fixtures/lazy-barrel/self-re-export/barrel/b.js Fixed typo: corrected export value from 'a' to 'b'
packages/rolldown/tests/fixtures/lazy-barrel/self-re-export/_config.ts Enabled test, updated expectations to account for all import records being loaded when a.js executes
packages/rolldown/tests/fixtures/lazy-barrel/multiple-entries/_config.ts Enabled test by removing skip flag and uncommenting lazyBarrel config
packages/rolldown/tests/fixtures/lazy-barrel/dynamic-import-entry/_config.ts Enabled test by removing skip flag and uncommenting lazyBarrel config
packages/rolldown/tests/fixtures/lazy-barrel/circular-star-exports/_config.ts Enabled test by removing skip flag and uncommenting lazyBarrel config
packages/rolldown/tests/fixtures/lazy-barrel/circular-exports/_config.ts Enabled test by removing skip flag and uncommenting lazyBarrel config
packages/rolldown/tests/fixtures/lazy-barrel/basic/_config.ts Enabled test by removing skip flag and uncommenting lazyBarrel config

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

This was referenced Jan 28, 2026
shulaoda added a commit that referenced this pull request Jan 28, 2026
## [1.0.0-rc.2] - 2026-01-28

⚡ Lazy Barrel Optimization

- Skips compilation of unused re-export modules in side-effect-free barrel modules
- Particularly beneficial for projects importing from large component libraries

For large component libraries like Ant Design, when you import just one component:

```js
import { Button } from 'antd';
Button;
```

| Metric                    | Without lazy barrel | With lazy barrel |
| -------------------- | --------------------- | ---------------- |
| Modules compiled | 2986                       | 250              |
| Build time               | ~210ms                  | ~50ms            |

By enabling lazy barrel, Rolldown reduces the number of compiled modules by 90% and speeds up the build by 2-4x. 

Enable it in your config:

```js
export default {
  experimental: {
    lazyBarrel: true,
  },
};
```

For more details, see the https://rolldown.rs/in-depth/lazy-barrel-optimization

### 💥 BREAKING CHANGES

- expose `\0rolldown/runtime` in transform hook (#8068) by @hyf0
- rename `rolldown:runtime` to `\0rolldown/runtime.js` (#8067) by @hyf0

### 🚀 Features

- remove inlined constants in smart mode (#8085) by @sapphi-red
- allow more options for `this.emitFile` with `type: 'prebuilt-chunk'` (#8062) by @sapphi-red
- warn when both code and postBanner contain shebang (#8039) by @Copilot

### 🐛 Bug Fixes

- update the links to Rolldown docs in the error messages (#8103) by @sapphi-red
- handle tsconfig.json load errors (#8105) by @sapphi-red
- include inlined constants in namespace object (#8099) by @sapphi-red
- vite test ci (#8084) by @IWANABETHATGUY
- renamer: nested binding shadowing external module namespace in UMD/IIFE formats (#8083) by @Dunqing
- deduplicate ESM chunk imports by canonical symbol (#8059) by @IWANABETHATGUY
- refine side-effect detection for BigInt and RegExp (#8060) by @IWANABETHATGUY
- rust: use string literal span for `new URL` error diagnostic (#8043) by @valadaptive
- rust: use ModuleType::Asset for `new URL` imports (#8035) by @valadaptive
- CJS-ESM interop - property assignment on CJS module exports (#8006) by @IWANABETHATGUY
- eliminate the facade chunk if the dynamic entry module has been merged into common chunk (#8046) by @IWANABETHATGUY
- Inlining dynamic imports broken with multiple entry points (#8037) by @IWANABETHATGUY
- devtools: revert `Chunk#id` to `Chunk#chunk_id` (#8040) by @hyf0
- invert `__exportAll` parameter logic to reduce default output size (#8036) by @Copilot
- `</script` tag search should be case insensitive (#8033) by @IWANABETHATGUY
- use directory name as-is for the variable name even if the name contained `.` (#8029) by @Copilot
- dev/lazy: remove unnecessary rewrite from top level `this` to `undefined` (#8020) by @hyf0
- dev/lazy: should keep lazy entries imports for patch file (#8019) by @hyf0
- `output.generatedCode.preset: 'es2015'` was not set by default (#8026) by @sapphi-red
- node: align option validator to types (#8023) by @sapphi-red
- node: allow `output.strictExecutionOrder` by the option validator (#8022) by @sapphi-red
- types: return `this` from on / off methods of `RolldownWatcher` (#8015) by @sapphi-red

### 🚜 Refactor

- rolldown_plugin_vite_dynamic_import_vars: remove v1 implementation (#8096) by @shulaoda
- rolldown_plugin_vite_import_glob: remove v1 implementation (#8095) by @shulaoda
- lazy-barrel: restructure lazy barrel implementation (#8070) by @shulaoda
- remove `use_built_ins` and `use_spread` from internal JSX options (#8079) by @sapphi-red
- remove `experimental.transformHiresSourcemap` (#8055) by @Copilot
- rust: use `is_data_url` more consistently (#8042) by @valadaptive
- use `FxIndexMap` to store EntryPoint (#8032) by @IWANABETHATGUY
- node: add type checks that ensures validator schema is up to date with types (#8024) by @sapphi-red

### 📚 Documentation

- link to vite plugin registry (#8086) by @sapphi-red
- lazy-barrel: improve documentation and enable in sidebar (#8072) by @shulaoda
- add more examples and details (#8054) by @sapphi-red
- in-depth: add dead code elimination page (#8007) by @sapphi-red
- update status from beta to release candidate (#8012) by @shulaoda

### ⚡ Performance

- run inline-const pass for modules that are affected by inlining (#8064) by @sapphi-red

### 🧪 Testing

- lazy-barrel: use package.json sideEffects instead of plugin hook (#8077) by @shulaoda
- lazy-barrel: enable tests and add treeshake-behavior cases (#8071) by @shulaoda

### ⚙️ Miscellaneous Tasks

- deps: update crate-ci/typos action to v1.42.3 (#8087) by @renovate[bot]
- deps: update rollup submodule for tests to v4.56.0 (#8073) by @sapphi-red
- deps: update oxc to v0.111.0 (#8063) by @renovate[bot]
- deps: update dependency rolldown-plugin-dts to v0.21.6 (#8076) by @renovate[bot]
- deps: update test262 submodule for tests (#8074) by @sapphi-red
- deps: update crate-ci/typos action to v1.42.2 (#8069) by @renovate[bot]
- deps: update oxc apps (#8066) by @renovate[bot]
- remove `{@include ./foo.md}` from d.ts files (#8056) by @sapphi-red
- deps: update dependency oxlint-tsgolint to v0.11.2 (#8057) by @renovate[bot]
- deps: update github-actions (#8050) by @renovate[bot]
- deps: update npm packages (#8051) by @renovate[bot]
- deps: update rust crates (#8049) by @renovate[bot]
- debug: add IdxExt debug trait for human-readable index debugging (#8045) by @IWANABETHATGUY
- deps: update dependency rolldown-plugin-dts to v0.21.5 (#8034) by @renovate[bot]
- deps: update oxc resolver to v11.16.4 (#8031) by @renovate[bot]
- deps: update dependency rolldown-plugin-dts to v0.21.4 (#8030) by @renovate[bot]
- deps: update dependency rust to v1.93.0 (#8018) by @renovate[bot]
- archive 2025 beta changelog (#8014) by @shulaoda
- update release workflow version pattern from beta to rc (#8013) by @shulaoda

### ❤️ New Contributors

* @valadaptive made their first contribution in [#8043](#8043)

Co-authored-by: shulaoda <[email protected]>
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