Skip to content

Comments

refactor(rust): remove inline_dynamic_imports, introduce code_splitting instead#7871

Merged
hyf0 merged 2 commits into01-13-feat_add_codesplitting_auto_none_and_deprecate_inlinedynamicimports_from
01-14-refactor_rust_remove_inline_dynamic_imports_introduce_code_splitting_instead
Jan 15, 2026
Merged

refactor(rust): remove inline_dynamic_imports, introduce code_splitting instead#7871
hyf0 merged 2 commits into01-13-feat_add_codesplitting_auto_none_and_deprecate_inlinedynamicimports_from
01-14-refactor_rust_remove_inline_dynamic_imports_introduce_code_splitting_instead

Conversation

@hyf0
Copy link
Member

@hyf0 hyf0 commented Jan 14, 2026

No description provided.

Copy link
Member Author

hyf0 commented Jan 14, 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.

@hyf0 hyf0 marked this pull request as ready for review January 14, 2026 05:55
Copilot AI review requested due to automatic review settings January 14, 2026 05:55
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 refactors the codebase to replace the boolean inlineDynamicImports option with a new codeSplitting enum option that accepts 'auto' (default) or 'none' values. This provides a more extensible API design for future code splitting modes while maintaining backward compatibility through a deprecated inlineDynamicImports option.

Changes:

  • Introduced CodeSplittingMode enum with Auto and None variants
  • Replaced inline_dynamic_imports: bool with code_splitting: CodeSplittingMode throughout the Rust codebase
  • Added TypeScript backward compatibility layer that maps deprecated inlineDynamicImports to new codeSplitting option
  • Updated error messages to reference the new codeSplitting option while keeping old variant names for compatibility

Reviewed changes

Copilot reviewed 20 out of 20 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
crates/rolldown_common/src/inner_bundler_options/types/code_splitting_mode.rs New enum definition for CodeSplittingMode with Auto and None variants
crates/rolldown_common/src/lib.rs Exports the new CodeSplittingMode type
crates/rolldown_common/src/inner_bundler_options/types/mod.rs Adds module for code_splitting_mode
crates/rolldown_common/src/inner_bundler_options/types/normalized_bundler_options.rs Replaces inline_dynamic_imports: bool with code_splitting: CodeSplittingMode
crates/rolldown_common/src/inner_bundler_options/mod.rs Updates BundlerOptions to use code_splitting field
crates/rolldown_binding/src/types/binding_normalized_options.rs Changes getter to return string representation of code_splitting
crates/rolldown_binding/src/utils/normalize_binding_options.rs Maps inline_dynamic_imports option to code_splitting mode
crates/rolldown/src/utils/prepare_build_context.rs Updates option validation and normalization logic
crates/rolldown/src/stages/link_stage/tree_shaking/include_statements.rs Changes condition from inline_dynamic_imports to code_splitting.is_none()
crates/rolldown/src/stages/link_stage/sort_modules.rs Changes condition from inline_dynamic_imports to code_splitting.is_none()
crates/rolldown/src/stages/link_stage/reference_needed_symbols.rs Changes condition from inline_dynamic_imports to code_splitting.is_none()
crates/rolldown/src/stages/link_stage/determine_module_exports_kind.rs Changes condition from inline_dynamic_imports to code_splitting.is_none()
crates/rolldown/src/stages/generate_stage/on_demand_wrapping.rs Updates comment to reference code_splitting
crates/rolldown/src/module_finalizers/mod.rs Changes condition from inline_dynamic_imports to code_splitting.is_none()
crates/rolldown_plugin_vite_reporter/src/lib.rs Changes condition from inline_dynamic_imports to code_splitting.is_none()
crates/rolldown_error/src/build_diagnostic/events/invalid_option.rs Adds new error variants for CodeSplittingNone* options
crates/rolldown_testing_config/src/config_variant.rs Maps deprecated inline_dynamic_imports config to new code_splitting
crates/rolldown_testing/_config.schema.json Updates schema to use CodeSplittingMode type
packages/rolldown/src/binding.d.cts Updates binding type from boolean to string
packages/rolldown/src/options/normalized-output-options.ts Adds codeSplitting field and deprecates inlineDynamicImports
Comments suppressed due to low confidence (2)

crates/rolldown_error/src/build_diagnostic/events/invalid_option.rs:40

  • This error message still references the deprecated output.inlineDynamicImports option. Update it to recommend output.codeSplitting: 'none' instead for consistency with the new API.
          format!("Invalid value \"{format}\" for option \"output.format\" - UMD and IIFE are not supported for code-splitting builds. You may set `output.inlineDynamicImports` to `true` when using dynamic imports.")

crates/rolldown_error/src/build_diagnostic/events/invalid_option.rs:45

  • This error message still references the deprecated output.inlineDynamicImports option. Update it to recommend output.codeSplitting: 'none' instead for consistency with the new API.
        InvalidOptionType::InvalidOutputFile => "Invalid value for option \"output.file\" - When building multiple chunks, the \"output.dir\" option must be used, not \"output.file\". You may set `output.inlineDynamicImports` to `true` when using dynamic imports.".to_string(),

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

@github-actions
Copy link
Contributor

github-actions bot commented Jan 14, 2026

Benchmarks Rust

  • target: graphite-base/7871(9c26984)
  • pr: 01-14-refactor_rust_remove_inline_dynamic_imports_introduce_code_splitting_instead(5e8d52b)
group                                                        pr                                     target
-----                                                        --                                     ------
bundle/bundle@multi-duplicated-top-level-symbol              1.05     76.4±3.42ms        ? ?/sec    1.00     72.8±2.93ms        ? ?/sec
bundle/bundle@multi-duplicated-top-level-symbol-sourcemap    1.01     81.2±2.57ms        ? ?/sec    1.00     80.6±4.16ms        ? ?/sec
bundle/bundle@rome_ts                                        1.02    105.8±3.56ms        ? ?/sec    1.00    103.8±2.22ms        ? ?/sec
bundle/bundle@rome_ts-sourcemap                              1.00    117.1±1.91ms        ? ?/sec    1.00    116.5±2.58ms        ? ?/sec
bundle/bundle@threejs                                        1.02     38.1±2.31ms        ? ?/sec    1.00     37.2±0.74ms        ? ?/sec
bundle/bundle@threejs-sourcemap                              1.00     42.3±0.87ms        ? ?/sec    1.00     42.2±0.83ms        ? ?/sec
bundle/bundle@threejs10x                                     1.00    380.7±6.13ms        ? ?/sec    1.01    384.5±4.80ms        ? ?/sec
bundle/bundle@threejs10x-sourcemap                           1.00    439.3±6.99ms        ? ?/sec    1.01    443.6±4.65ms        ? ?/sec
scan/scan@rome_ts                                            1.00     82.5±2.45ms        ? ?/sec    1.02     83.8±1.90ms        ? ?/sec
scan/scan@threejs                                            1.00     28.5±0.47ms        ? ?/sec    1.02     29.1±1.81ms        ? ?/sec
scan/scan@threejs10x                                         1.01    289.9±4.01ms        ? ?/sec    1.00    287.8±4.42ms        ? ?/sec

@hyf0 hyf0 changed the base branch from 01-13-feat_add_codesplitting_auto_none_and_deprecate_inlinedynamicimports_ to graphite-base/7871 January 14, 2026 12:19
@hyf0 hyf0 force-pushed the graphite-base/7871 branch from a051552 to abf4654 Compare January 14, 2026 14:45
@hyf0 hyf0 force-pushed the 01-14-refactor_rust_remove_inline_dynamic_imports_introduce_code_splitting_instead branch 2 times, most recently from 07bc8bf to 5e07689 Compare January 14, 2026 15:03
@hyf0 hyf0 changed the base branch from graphite-base/7871 to 01-13-feat_add_codesplitting_auto_none_and_deprecate_inlinedynamicimports_ January 14, 2026 15:03
@hyf0 hyf0 requested a review from sapphi-red January 14, 2026 15:11
@hyf0 hyf0 changed the base branch from 01-13-feat_add_codesplitting_auto_none_and_deprecate_inlinedynamicimports_ to graphite-base/7871 January 14, 2026 16:38
@hyf0 hyf0 force-pushed the 01-14-refactor_rust_remove_inline_dynamic_imports_introduce_code_splitting_instead branch from 5e07689 to 93fcada Compare January 14, 2026 16:39
@hyf0 hyf0 force-pushed the graphite-base/7871 branch from abf4654 to fa37dc5 Compare January 14, 2026 16:39
@hyf0 hyf0 force-pushed the 01-14-refactor_rust_remove_inline_dynamic_imports_introduce_code_splitting_instead branch from 93fcada to 280586c Compare January 14, 2026 19:19
@hyf0 hyf0 force-pushed the graphite-base/7871 branch from fa37dc5 to e3433f3 Compare January 14, 2026 19:19
@hyf0 hyf0 force-pushed the 01-14-refactor_rust_remove_inline_dynamic_imports_introduce_code_splitting_instead branch from 280586c to 5e8d52b Compare January 15, 2026 03:51
@hyf0 hyf0 force-pushed the graphite-base/7871 branch from e3433f3 to 9c26984 Compare January 15, 2026 03:51
@hyf0 hyf0 requested a review from Copilot January 15, 2026 03:56
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 37 out of 37 changed files in this pull request and generated 3 comments.

Comments suppressed due to low confidence (1)

crates/rolldown_error/src/build_diagnostic/events/invalid_option.rs:6

  • The UnsupportedInlineDynamicFormat error variant is no longer used in the codebase (replaced by UnsupportedCodeSplittingFormat), but is still defined. Since the PR introduces new error variants (CodeSplittingNoneWithMultipleInputs, etc.) that handle the new cases, this old variant should be removed to avoid confusion and maintain consistency with the refactoring goal.

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

@hyf0 hyf0 marked this pull request as draft January 15, 2026 04:40
@hyf0 hyf0 force-pushed the 01-14-refactor_rust_remove_inline_dynamic_imports_introduce_code_splitting_instead branch from 5e8d52b to f929d88 Compare January 15, 2026 05:03
@hyf0 hyf0 force-pushed the graphite-base/7871 branch from 9c26984 to 554d323 Compare January 15, 2026 05:03
@hyf0 hyf0 changed the base branch from graphite-base/7871 to 01-13-feat_add_codesplitting_auto_none_and_deprecate_inlinedynamicimports_ January 15, 2026 05:03
@hyf0 hyf0 marked this pull request as ready for review January 15, 2026 05:03
@hyf0 hyf0 requested a review from sapphi-red January 15, 2026 05:04
Copy link
Member Author

hyf0 commented Jan 15, 2026

Merge activity

  • Jan 15, 5:04 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.

@graphite-app graphite-app bot changed the base branch from 01-13-feat_add_codesplitting_auto_none_and_deprecate_inlinedynamicimports_ to graphite-base/7871 January 15, 2026 05:22
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 after the CI is fixed

@hyf0 hyf0 force-pushed the 01-14-refactor_rust_remove_inline_dynamic_imports_introduce_code_splitting_instead branch from dc32466 to 7d15a92 Compare January 15, 2026 05:58
@hyf0 hyf0 changed the base branch from graphite-base/7871 to 01-13-feat_add_codesplitting_auto_none_and_deprecate_inlinedynamicimports_ January 15, 2026 05:58
@hyf0
Copy link
Member Author

hyf0 commented Jan 15, 2026

Watch tests is killing me.

@hyf0 hyf0 merged commit 0931062 into 01-13-feat_add_codesplitting_auto_none_and_deprecate_inlinedynamicimports_ Jan 15, 2026
52 of 53 checks passed
@hyf0 hyf0 deleted the 01-14-refactor_rust_remove_inline_dynamic_imports_introduce_code_splitting_instead branch January 15, 2026 06:39
hyf0 added a commit that referenced this pull request Jan 15, 2026
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