Skip to content

feat(code-splitting): add group-local recursive dependency control#9488

Draft
aminpaks wants to merge 4 commits into
rolldown:mainfrom
aminpaks:amin--group-local-recursive-deps
Draft

feat(code-splitting): add group-local recursive dependency control#9488
aminpaks wants to merge 4 commits into
rolldown:mainfrom
aminpaks:amin--group-local-recursive-deps

Conversation

@aminpaks

Copy link
Copy Markdown
Contributor

What

Adds includeDependenciesRecursively to manual code-splitting groups.

A group-local value overrides the top-level codeSplitting.includeDependenciesRecursively; omitted group values inherit the top-level option, and the default remains true.

This updates the Rust options, NAPI binding normalization, generated binding types, TypeScript public types, option validation, JSON config schema, docs, and regression fixtures.

Fixes #9467.

Why

Some manual code-splitting groups need to capture only the modules they directly match, while other groups should keep Rolldown’s existing recursive dependency capture behavior.

The existing top-level option can only disable recursive dependency capture globally, which changes every manual group at once. Making the option group-local allows targeted opt-outs without changing unrelated groups.

The preserve-entry-signature validation now uses the effective group/global value, so non-recursive groups keep the same safety checks as the existing top-level option.

Tophat

Validated locally with:

  • cargo fmt --all -- --emit=files
  • cargo check -q
  • CI=true just build-rolldown
  • targeted cargo run-fixture coverage for:
    • group-local includeDependenciesRecursively: false
    • inherited top-level includeDependenciesRecursively: false
    • group-local true overriding top-level false
    • preserve-entry-signature error/warning paths

A full just test-update run was attempted; this local checkout could not complete the full workspace run because the test262 submodule is not initialized.

AI disclosure

AI assistance was used while developing this change. I reviewed, tested, and validated the implementation before submission.

@aminpaks aminpaks changed the title Add group-local recursive dependency control feat(code-splitting): add group-local recursive dependency control May 20, 2026
@aminpaks aminpaks force-pushed the amin--group-local-recursive-deps branch from d9a50c5 to bb21cd0 Compare May 20, 2026 17:23
graphite-app Bot pushed a commit that referenced this pull request Jun 2, 2026
…vely` (#9587)

## Summary

- Allow `includeDependenciesRecursively` on individual `codeSplitting.groups`, overriding the global value
- When omitted on a group, inherits `codeSplitting.includeDependenciesRecursively` (default `true`)
- Extends `preserveEntrySignatures` validation to check both global and per-group values

Closes #9467

Built on the exploration in #9488 — thank you @aminpaks for the thorough investigation and initial implementation! 🙏

## Changes

| Layer | File | Change |
|-------|------|--------|
| Rust types | `manual_code_splitting_options.rs` | Add `include_dependencies_recursively: Option<bool>` to `MatchGroup` |
| NAPI binding | `binding_manual_code_splitting_options.rs` | Add field to `BindingMatchGroup` |
| Binding conversion | `normalize_binding_options.rs` | Map new field |
| Chunk logic | `manual_code_splitting.rs` | Per-group fallback: group → global → `true` |
| Validation | `prepare_build_context.rs` | `has_non_recursive_dependency_capture()` helper, 2 callsites |
| TS types | `output-options.ts` | Add to `CodeSplittingGroup` with JSDoc |
| TS validator | `validator.ts` | Add to group schema |

## Example

```js
output: {
  codeSplitting: {
    includeDependenciesRecursively: true,
    groups: [
      {
        name: 'route-alpha',
        test: /routes\/alpha\//,
        includeDependenciesRecursively: false, // route-only, no sibling deps
      },
      {
        name: 'shared',
        test: /shared\//,
        // inherits global (true)
      },
    ],
  },
}
```

## Test plan

- [x] Chunking behavior test: group with `false` excludes transitive deps, group without inherits global
- [x] Validation test: per-group `false` + `preserveEntrySignatures: 'strict'` → error
- [x] All existing `advanced-chunks` tests pass
- [x] Full build (`just build-rolldown`) passes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support group-local includeDependenciesRecursively for route fanout chunking

1 participant