Skip to content

Comments

feat(option): add experimental option to control chunk optimization#7738

Merged
graphite-app[bot] merged 1 commit intomainfrom
01-03-add_new_option_to_opt_out_chunk_optimization
Jan 3, 2026
Merged

feat(option): add experimental option to control chunk optimization#7738
graphite-app[bot] merged 1 commit intomainfrom
01-03-add_new_option_to_opt_out_chunk_optimization

Conversation

@IWANABETHATGUY
Copy link
Member

No description provided.

Copy link
Member Author


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.

@netlify
Copy link

netlify bot commented Jan 3, 2026

Deploy Preview for rolldown-rs ready!

Name Link
🔨 Latest commit d2a77eb
🔍 Latest deploy log https://app.netlify.com/projects/rolldown-rs/deploys/695943ec5d489b0008dc287c
😎 Deploy Preview https://deploy-preview-7738--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.

@IWANABETHATGUY IWANABETHATGUY changed the title add new option to opt out chunk optimization feat: add experimental option to control chunk optimization Jan 3, 2026
@IWANABETHATGUY IWANABETHATGUY marked this pull request as ready for review January 3, 2026 06:03
Copilot AI review requested due to automatic review settings January 3, 2026 06:03
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 adds an experimental option optimizeChunks to control chunk optimization behavior in rolldown. The option allows disabling an optimization where entry chunks can have different exports than the underlying entry module, which helps reduce the number of generated chunks when enabled.

Key changes:

  • Adds optimizeChunks experimental option with a default value of true (enabled by default)
  • Implements the option across TypeScript/JavaScript and Rust layers
  • Updates chunk generation logic to respect this option when determining whether to optimize chunks
  • Adds test coverage with a config variant to test the behavior when the optimization is disabled

Reviewed changes

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

Show a summary per file
File Description
packages/rolldown/src/options/input-options.ts Adds TypeScript interface and comprehensive documentation for the optimizeChunks option
packages/rolldown/src/utils/validator.ts Adds validation schema for the new experimental option
packages/rolldown/src/utils/bindingify-input-options.ts Passes the option from TypeScript to Rust binding layer
packages/rolldown/src/binding.d.cts Adds TypeScript type definition for the binding interface
crates/rolldown_common/src/inner_bundler_options/types/experimental_options.rs Defines the Rust option field and helper method with default value
crates/rolldown_binding/src/options/binding_input_options/binding_experimental_options.rs Implements conversion from binding layer to internal Rust types
crates/rolldown/src/stages/generate_stage/code_splitting.rs Integrates the option into chunk optimization logic, gating both common chunk insertion and facade optimization
crates/rolldown_testing_config/src/config_variant.rs Adds test configuration support for the option (with naming inconsistency)
crates/rolldown_testing/_config.schema.json Updates JSON schema for test configurations (with naming inconsistency)
crates/rolldown/tests/rolldown/code_splitting/issue_5276/_config.json Adds test variant to verify behavior when optimization is disabled (with naming inconsistency)
crates/rolldown/tests/rolldown/code_splitting/issue_5276/main.js Updates test assertions to handle facade chunk module exports correctly
crates/rolldown/tests/rolldown/code_splitting/issue_5276/artifacts.snap Updates snapshot with new test variant output
crates/rolldown/tests/snapshots/integration_rolldown__filename_with_hash.snap Updates hash snapshot due to code changes

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

@pkg-pr-new
Copy link

pkg-pr-new bot commented Jan 3, 2026

Open in StackBlitz

@rolldown/browser

npm i https://pkg.pr.new/@rolldown/browser@7738

@rolldown/debug

npm i https://pkg.pr.new/@rolldown/debug@7738

@rolldown/pluginutils

npm i https://pkg.pr.new/@rolldown/pluginutils@7738

rolldown

npm i https://pkg.pr.new/rolldown@7738

@rolldown/binding-android-arm64

npm i https://pkg.pr.new/@rolldown/binding-android-arm64@7738

@rolldown/binding-darwin-arm64

npm i https://pkg.pr.new/@rolldown/binding-darwin-arm64@7738

@rolldown/binding-darwin-x64

npm i https://pkg.pr.new/@rolldown/binding-darwin-x64@7738

@rolldown/binding-freebsd-x64

npm i https://pkg.pr.new/@rolldown/binding-freebsd-x64@7738

@rolldown/binding-linux-arm-gnueabihf

npm i https://pkg.pr.new/@rolldown/binding-linux-arm-gnueabihf@7738

@rolldown/binding-linux-arm64-gnu

npm i https://pkg.pr.new/@rolldown/binding-linux-arm64-gnu@7738

@rolldown/binding-linux-arm64-musl

npm i https://pkg.pr.new/@rolldown/binding-linux-arm64-musl@7738

@rolldown/binding-linux-x64-gnu

npm i https://pkg.pr.new/@rolldown/binding-linux-x64-gnu@7738

@rolldown/binding-linux-x64-musl

npm i https://pkg.pr.new/@rolldown/binding-linux-x64-musl@7738

@rolldown/binding-openharmony-arm64

npm i https://pkg.pr.new/@rolldown/binding-openharmony-arm64@7738

@rolldown/binding-wasm32-wasi

npm i https://pkg.pr.new/@rolldown/binding-wasm32-wasi@7738

@rolldown/binding-win32-arm64-msvc

npm i https://pkg.pr.new/@rolldown/binding-win32-arm64-msvc@7738

@rolldown/binding-win32-x64-msvc

npm i https://pkg.pr.new/@rolldown/binding-win32-x64-msvc@7738

commit: d53a538

@github-actions
Copy link
Contributor

github-actions bot commented Jan 3, 2026

Benchmarks Rust

  • target: main(2ee2b1c)
  • pr: 01-03-add_new_option_to_opt_out_chunk_optimization(d2a77eb)
group                                                        pr                                     target
-----                                                        --                                     ------
bundle/bundle@multi-duplicated-top-level-symbol              1.00     62.3±1.53ms        ? ?/sec    1.02     63.5±2.08ms        ? ?/sec
bundle/bundle@multi-duplicated-top-level-symbol-sourcemap    1.00     68.7±1.70ms        ? ?/sec    1.01     69.4±1.82ms        ? ?/sec
bundle/bundle@rome_ts                                        1.00    106.8±2.87ms        ? ?/sec    1.00    106.8±1.71ms        ? ?/sec
bundle/bundle@rome_ts-sourcemap                              1.00    117.3±1.69ms        ? ?/sec    1.00    117.7±1.64ms        ? ?/sec
bundle/bundle@threejs                                        1.00     38.2±2.08ms        ? ?/sec    1.00     38.4±2.16ms        ? ?/sec
bundle/bundle@threejs-sourcemap                              1.01     43.1±1.07ms        ? ?/sec    1.00     42.6±0.65ms        ? ?/sec
bundle/bundle@threejs10x                                     1.00    386.9±3.50ms        ? ?/sec    1.01    390.7±7.16ms        ? ?/sec
bundle/bundle@threejs10x-sourcemap                           1.00    446.8±4.44ms        ? ?/sec    1.02    453.9±7.34ms        ? ?/sec
scan/scan@rome_ts                                            1.00     85.4±2.11ms        ? ?/sec    1.01     85.9±1.92ms        ? ?/sec
scan/scan@threejs                                            1.00     29.2±1.60ms        ? ?/sec    1.03     30.2±2.36ms        ? ?/sec
scan/scan@threejs10x                                         1.00    296.4±4.83ms        ? ?/sec    1.00    297.8±5.57ms        ? ?/sec

@IWANABETHATGUY IWANABETHATGUY force-pushed the 01-03-add_new_option_to_opt_out_chunk_optimization branch from 7c0ba07 to d53a538 Compare January 3, 2026 06:27
Copilot AI review requested due to automatic review settings January 3, 2026 06:50
@IWANABETHATGUY IWANABETHATGUY force-pushed the 01-03-add_new_option_to_opt_out_chunk_optimization branch from d53a538 to 43c0c4a Compare January 3, 2026 06:50
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

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


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

@IWANABETHATGUY IWANABETHATGUY force-pushed the 01-03-add_new_option_to_opt_out_chunk_optimization branch from 43c0c4a to 0840413 Compare January 3, 2026 07:33
@graphite-app
Copy link
Contributor

graphite-app bot commented Jan 3, 2026

Merge activity

@IWANABETHATGUY IWANABETHATGUY changed the title feat: add experimental option to control chunk optimization feat(option): add experimental option to control chunk optimization Jan 3, 2026
@graphite-app graphite-app bot force-pushed the 01-03-add_new_option_to_opt_out_chunk_optimization branch from 0840413 to d2a77eb Compare January 3, 2026 16:29
@graphite-app graphite-app bot merged commit d2a77eb into main Jan 3, 2026
33 checks passed
@graphite-app graphite-app bot deleted the 01-03-add_new_option_to_opt_out_chunk_optimization branch January 3, 2026 16:39
@github-actions github-actions bot mentioned this pull request Jan 7, 2026
@github-actions github-actions bot mentioned this pull request Jan 7, 2026
shulaoda added a commit that referenced this pull request Jan 7, 2026
## [1.0.0-beta.59] - 2026-01-07

⚡ Inline Dynamic Imports for Statically Imported Modules

- When a module is already statically imported, dynamic imports to that same module are now inlined instead of creating a separate chunk

### 🚀 Features

- plugin_timings: add 3s threshold and doc link to warning message (#7741) by @shulaoda
- improve treeshaking logic to handle empty parameter list in dynamic import .then() callbacks (#7781) by @Copilot
- dev/lazy: don't include already executed modules (#7745) by @hyf0
- dev/lazy: support dynamic `import(..)` (#7726) by @hyf0
- inline dynamic imports that imports statically imported modules (#7742) by @IWANABETHATGUY
- option: add experimental option to control chunk optimization (#7738) by @IWANABETHATGUY

### 🐛 Bug Fixes

- inline dynamic entry to user defined entry with esm wrap kind (#7783) by @IWANABETHATGUY
- use canonical namespace reference for property access (#7777) by @IWANABETHATGUY
- dynamic entry merged into common chunk with cjs and esm wrap kind (#7771) by @IWANABETHATGUY
- tla: should not await non-tla-related modules (#7768) by @hyf0
- dynamic entry captured by common chunk with CJS format (#7757) by @IWANABETHATGUY
- module_loader: mark emitted chunks as user-defined entry when already loaded (#7765) by @shulaoda
- normalize preserveModulesRoot path (#7737) by @IWANABETHATGUY
- linker: resolve race condition in side effects computation for export-star (#7728) by @camc314

### 🚜 Refactor

- plugin_timings: filter out plugins with duration < 1s from timing warnings (#7785) by @shulaoda
- module_loader: remove unnecessary collect before extend (#7769) by @shulaoda
- rename _id suffixes to _idx for oxc_index types (#7767) by @IWANABETHATGUY
- remove duplicate `preserve_entry_signatures` from `AddEntryModuleMsg` (#7762) by @shulaoda
- module_loader: pass `user_defined_entries` by reference (#7756) by @shulaoda
- dev/lazy: get proxy entry's `ResolvedId` correctly (#7746) by @hyf0
- simplify try_rewrite_import_expression control flow (#7753) by @IWANABETHATGUY
- module_loader: remove unnecessary dynamic import handling for runtime module (#7754) by @shulaoda
- inline __toDynamicImportESM  (#7747) by @IWANABETHATGUY
- use From impl for ModuleLoaderOutput conversion (#7732) by @shulaoda
- remove duplicate fields from `ModuleLoader` (#7731) by @shulaoda
- tweak `resolve_user_defined_entries` (#7727) by @shulaoda

### 📚 Documentation

- add rolldown-string reference to native MagicString compatibility section (#7778) by @Copilot
- improve comments for export star side effects handling (#7730) by @IWANABETHATGUY

### 🧪 Testing

- use assertion instead of console.log for some testcase (#7744) by @IWANABETHATGUY

### ⚙️ Miscellaneous Tasks

- tweak some `output.dynamicImportInCjs` related rollup test results (#7776) by @sapphi-red
- mark esbuild/dce/dce_of_symbol_ctor_call as passed (#7775) by @sapphi-red
- deps: update oxc apps (#7772) by @renovate[bot]
- vite-tests: allow running on PRs with `test: vite-tests` label (#7770) by @shulaoda
- deps: update oxc apps (#7760) by @renovate[bot]
- deps: update rollup submodule for tests to v4.55.1 (#7763) by @sapphi-red
- deps: update test262 submodule for tests (#7764) by @sapphi-red
- deps: update oxc to v0.107.0 (#7758) by @camc314
- deps: update taiki-e/install-action action to v2.65.13 (#7751) by @renovate[bot]
- deps: update rust crates (#7750) by @renovate[bot]
- deps: update npm packages (#7749) by @renovate[bot]
- deps: update github-actions (#7748) by @renovate[bot]
- deps: update dependency oxlint-tsgolint to v0.10.1 (#7729) by @renovate[bot]
- deps: update crate-ci/typos action to v1.41.0 (#7725) by @renovate[bot]

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