Skip to content

feat: add INEFFECTIVE_DYNAMIC_IMPORT warning in core#8284

Merged
graphite-app[bot] merged 1 commit intomainfrom
02-12-feat_add_ineffective_dynamic_import_warning_in_core
Feb 12, 2026
Merged

feat: add INEFFECTIVE_DYNAMIC_IMPORT warning in core#8284
graphite-app[bot] merged 1 commit intomainfrom
02-12-feat_add_ineffective_dynamic_import_warning_in_core

Conversation

@shulaoda
Copy link
Member

@shulaoda shulaoda commented Feb 12, 2026

closes #7541, #7600, #7971


Thanks to @luke358 for the effort in PR #7600.
Thanks to @AliceLanniste for the effort in PR #7971.

Co-authored-by: luke358 qq1494135711@gmail.com
Co-authored-by: AliceLanniste 1399789151@qq.com

Copy link
Member Author

shulaoda commented Feb 12, 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.

@netlify
Copy link

netlify bot commented Feb 12, 2026

Deploy Preview for rolldown-rs canceled.

Name Link
🔨 Latest commit 80fa52b
🔍 Latest deploy log https://app.netlify.com/projects/rolldown-rs/deploys/698da2772b52a00008518e79

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

Adds a new core warning (INEFFECTIVE_DYNAMIC_IMPORT) to detect cases where a module is dynamically imported by a module in the same chunk (making that dynamic import ineffective for code splitting), and wires it through the checks/options surfaces (Rust core, bindings, JS validator/CLI), with snapshot updates to reflect the new warning output.

Changes:

  • Implement core detection in the generate stage and emit a new BuildDiagnostic warning (INEFFECTIVE_DYNAMIC_IMPORT).
  • Plumb the new check through Rust/TS option schemas, bindings, and CLI help output.
  • Update integration test snapshots (and a rollup-test config tweak) to account for the new warning.

Reviewed changes

Copilot reviewed 24 out of 28 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
packages/rollup-tests/test/function/index.js Adjust test harness options to disable the new check for a specific sample.
packages/rolldown/tests/cli/snapshots/cli-e2e.test.ts.snap Updates CLI snapshot to include the new --checks.ineffective-dynamic-import flag.
packages/rolldown/src/utils/validator.ts Extends JS-side validation schema with ineffectiveDynamicImport.
packages/rolldown/src/options/generated/checks-options.ts Adds the generated TS option ineffectiveDynamicImport.
packages/rolldown/src/binding.d.cts Extends binding type definitions with ineffectiveDynamicImport.
crates/rolldown_testing/_config.schema.json Adds the new check to the testing config JSON schema.
crates/rolldown_error/src/types/event_kind.rs Introduces EventKind::IneffectiveDynamicImport.
crates/rolldown_error/src/generated/event_kind_switcher.rs Adds the corresponding bitflag switcher entry.
crates/rolldown_error/src/build_diagnostic/events/mod.rs Registers the new diagnostic event module.
crates/rolldown_error/src/build_diagnostic/events/ineffective_dynamic_import.rs Defines the warning payload and message formatting.
crates/rolldown_error/src/build_diagnostic/constructors.rs Adds a constructor for the new diagnostic.
crates/rolldown_common/src/generated/checks_options.rs Adds the new check to Rust-side generated ChecksOptions and maps it to EventKindSwitcher.
crates/rolldown_binding/src/generated/binding_checks_options.rs Plumbs the new check through the Rust↔binding options conversion.
crates/rolldown/tests/rolldown/topics/hmr/import_meta_hot_accept/artifacts.snap Snapshot updates to include new warnings.
crates/rolldown/tests/rolldown/topics/hmr/change_accept/artifacts.snap Snapshot updates to include new warnings.
crates/rolldown/tests/rolldown/optimization/chunk_merging/issue_4905/artifacts.snap Snapshot updates to include new warnings.
crates/rolldown/tests/rolldown/optimization/chunk_merging/dynamic_import_cjs_same_chunk/artifacts.snap Snapshot updates to include new warnings.
crates/rolldown/tests/rolldown/optimization/chunk_merging/dynamic_entry_merged_in_user_defined_entry/artifacts.snap Snapshot updates to include new warnings.
crates/rolldown/tests/rolldown/function/external/splitting_indirect_external_symbol/artifacts.snap Snapshot updates to include new warnings.
crates/rolldown/tests/rolldown/function/experimental/attach_debug_info/eliminated_facade_chunk/artifacts.snap Snapshot updates to include new warnings.
crates/rolldown/tests/rolldown/code_splitting/issue_8184/artifacts.snap Snapshot updates to include new warnings.
crates/rolldown/tests/rolldown/code_splitting/issue_2786/artifacts.snap Snapshot updates to include new warnings.
crates/rolldown/tests/rolldown/code_splitting/dynamic_import_and_static_import_one_file/artifacts.snap Snapshot updates to include new warnings.
crates/rolldown/tests/esbuild/splitting/splitting_dynamic_and_not_dynamic_es6_into_es6/artifacts.snap Snapshot updates to include new warnings.
crates/rolldown/tests/esbuild/splitting/splitting_dynamic_and_not_dynamic_common_js_into_es6/artifacts.snap Snapshot updates to include new warnings.
crates/rolldown/tests/esbuild/default/this_with_es6_syntax/artifacts.snap Snapshot updates to include new warnings.
crates/rolldown/src/stages/generate_stage/mod.rs Hooks the new detection pass into the generate stage pipeline.
crates/rolldown/src/stages/generate_stage/detect_ineffective_dynamic_imports.rs Implements detection logic and warning emission in core.

@github-actions
Copy link
Contributor

Benchmarks Rust

  • target: main(7fc2cd8)
  • pr: 02-12-feat_add_ineffective_dynamic_import_warning_in_core(0c7861e)
group                                                        pr                                     target
-----                                                        --                                     ------
bundle/bundle@multi-duplicated-top-level-symbol              1.02     70.3±1.65ms        ? ?/sec    1.00     69.1±1.62ms        ? ?/sec
bundle/bundle@multi-duplicated-top-level-symbol-sourcemap    1.00     73.4±1.82ms        ? ?/sec    1.04     76.1±1.46ms        ? ?/sec
bundle/bundle@rome_ts                                        1.02    100.5±3.24ms        ? ?/sec    1.00     98.6±1.76ms        ? ?/sec
bundle/bundle@rome_ts-sourcemap                              1.00    110.8±1.65ms        ? ?/sec    1.01    111.7±2.63ms        ? ?/sec
bundle/bundle@threejs                                        1.00     34.5±0.60ms        ? ?/sec    1.00     34.5±0.68ms        ? ?/sec
bundle/bundle@threejs-sourcemap                              1.03     40.6±0.76ms        ? ?/sec    1.00     39.5±0.62ms        ? ?/sec
bundle/bundle@threejs10x                                     1.02    370.9±5.23ms        ? ?/sec    1.00    364.4±6.05ms        ? ?/sec
bundle/bundle@threejs10x-sourcemap                           1.03    427.2±7.08ms        ? ?/sec    1.00    415.8±5.48ms        ? ?/sec
scan/scan@rome_ts                                            1.01     79.3±1.81ms        ? ?/sec    1.00     78.4±1.58ms        ? ?/sec
scan/scan@threejs                                            1.00     27.3±0.84ms        ? ?/sec    1.01     27.6±1.75ms        ? ?/sec
scan/scan@threejs10x                                         1.02    284.2±5.34ms        ? ?/sec    1.00    279.3±4.17ms        ? ?/sec

@graphite-app
Copy link
Contributor

graphite-app bot commented Feb 12, 2026

Merge activity

  • Feb 12, 9:29 AM UTC: shulaoda added this pull request to the Graphite merge queue.
  • Feb 12, 9:33 AM UTC: shulaoda removed this pull request from the Graphite merge queue.
  • Feb 12, 9:33 AM UTC: shulaoda removed this pull request from the Graphite merge queue.
  • Feb 12, 9:50 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.
  • Feb 12, 9:50 AM UTC: shulaoda added this pull request to the Graphite merge queue.
  • Feb 12, 9:51 AM UTC: The merge label 'graphite: merge-when-ready' was removed. This PR will no longer be merged by the Graphite merge queue
  • Feb 12, 10:05 AM UTC: Merged by the Graphite merge queue.

graphite-app bot pushed a commit that referenced this pull request Feb 12, 2026
closes #7541, #7971

---

Thanks to @AliceLanniste for the effort in PR #7971.

Co-authored-by: AliceLanniste <1399789151@qq.com>
@graphite-app graphite-app bot force-pushed the 02-12-feat_add_ineffective_dynamic_import_warning_in_core branch from 0c7861e to c2cdc7b Compare February 12, 2026 09:29
@sapphi-red
Copy link
Member

sapphi-red commented Feb 12, 2026

@shulaoda Can we emit this warning when we optimize the output (convert the dynamic import into a static import)?

@sapphi-red
Copy link
Member

This PR also closes #7600

@shulaoda
Copy link
Member Author

@shulaoda Can we emit this warning when we optimize the output (convert the dynamic import into a static import)?

Do you mean at the stage where they are merged into one chunk?

@sapphi-red
Copy link
Member

sapphi-red commented Feb 12, 2026

@shulaoda Can we emit this warning when we optimize the output (convert the dynamic import into a static import)?

Do you mean at the stage where they are merged into one chunk?

I think yes. I was thinking of the place we don't have to re-calculate the information.

@shulaoda
Copy link
Member Author

shulaoda commented Feb 12, 2026

@shulaoda Can we emit this warning when we optimize the output (convert the dynamic import into a static import)?

Do you mean at the stage where they are merged into one chunk?

I think yes. I was thinking of the place we don't have to re-calculate the information.

If I’m not mistaken, this effectively avoids iterating over chunk_graph.chunk_table.iter(), right? I’ll follow up with another PR to improve it further.

@sapphi-red
Copy link
Member

sapphi-red commented Feb 12, 2026

@shulaoda Can we emit this warning when we optimize the output (convert the dynamic import into a static import)?

Do you mean at the stage where they are merged into one chunk?

I think yes. I was thinking of the place we don't have to re-calculate the information.

If I’m not mistaken, this effectively avoids iterating over chunk_graph.chunk_table.iter(), right? I’ll follow up with another PR to improve it further.

Yes, doing it in a follow up PR is ok.

closes #7541, #7600, #7971

---

Thanks to @luke358 for the effort in PR #7600.
Thanks to @AliceLanniste for the effort in PR #7971.

Co-authored-by: luke358 <qq1494135711@gmail.com>
Co-authored-by: AliceLanniste <1399789151@qq.com>
Copilot AI review requested due to automatic review settings February 12, 2026 09:50
@graphite-app graphite-app bot force-pushed the 02-12-feat_add_ineffective_dynamic_import_warning_in_core branch from c2cdc7b to 80fa52b Compare February 12, 2026 09: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.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

@graphite-app graphite-app bot merged commit 80fa52b into main Feb 12, 2026
34 checks passed
@graphite-app graphite-app bot deleted the 02-12-feat_add_ineffective_dynamic_import_warning_in_core branch February 12, 2026 10:05
shulaoda pushed a commit that referenced this pull request Feb 18, 2026
## [1.0.0-rc.5] - 2026-02-18

💡 Smarter `entriesAware` Manual Code Splitting                                                                 
                                             
New `entriesAware` and `entriesAwareMergeThreshold` options for `manualCodeSplitting.groups[]` enable              
entry-reachability-based chunk splitting with automatic small chunk merging.                                       
                                                                                                                   
- `entriesAware: true` splits matched modules by entry reachability — modules reached by the same set of entries are grouped together, providing the most precise loading behavior with less over-fetching
- Chunks now get more readable names reflecting their entry associations (e.g. `vendor-entry-a-entry-b.js`) instead of opaque hashes
- `entriesAwareMergeThreshold` sets a byte-size threshold to merge tiny subgroups into the closest sibling with the fewest extra entries, reducing micro-chunk fragmentation while preserving precision
- Recommended to use together with `maxSize`: merge tiny chunks first to reduce request overhead, then cap large chunks to control payload size

```js
manualCodeSplitting: {
  groups: [{
    name: 'vendor',
    test: /node_modules/,
    entriesAware: true,
    entriesAwareMergeThreshold: 28000, // bytes
  }]
}
```

### 🚀 Features

- add `Visitor` to `rolldown/utils` (#8373) by @sapphi-red
- module-info: add `inputFormat` property to `ModuleInfo` (#8329) by @shulaoda
- default `treeshake.invalid_import_side_effects` to `false` (#8357) by @sapphi-red
- rolldown_utils: add `IndexBitSet` (#8343) by @sapphi-red
- rolldown_utils: add more methods and trait impls to BitSet (#8342) by @sapphi-red
- rolldown_plugin_vite_build_import_analysis: add support for `await import().then((m) => m.prop)` (#8328) by @sapphi-red
- rolldown_plugin_vite_reporter: support custom logger for build infos (#7652) by @shulaoda
- rust/mcs: support `entriesAwareMergeThreshold` (#8312) by @hyf0
- mcs: `maxSize` will split the oversized chunk with taking file relevance into account (#8277) by @hyf0
- rolldown_plugin_vite_import_glob: support template literal in glob import patterns (#8298) by @shulaoda
- rolldown_plugin_chunk_import_map: output importmap without spaces (#8297) by @sapphi-red
- add INEFFECTIVE_DYNAMIC_IMPORT warning in core (#8284) by @shulaoda
- mcs: generate more readable name for `entriesAware` chunks (#8275) by @hyf0
- mcs: support `entriesAware` (#8274) by @hyf0

### 🐛 Bug Fixes

- improve circular dependency detection in chunk optimizer (#8371) by @IWANABETHATGUY
- align `minify.compress: true` and `minify.mangle: true` with `minify: true` (#8367) by @sapphi-red
- rolldown_plugin_esm_external_require: apply conversion to UMD and IIFE outputs (#8359) by @sapphi-red
- cjs: bailout treeshaking on cjs modules that have multiple re-exports (#8348) by @hyf0
- handle member expression and this expression in JSX element name rewriting (#8323) by @IWANABETHATGUY
- pad `encode_hash_with_base` output to fixed length to prevent slice panics (#8320) by @shulaoda
- `xxhash_with_base` skips hashing when input is exactly 16 bytes (#8319) by @shulaoda
- complete `ImportKind::try_from` with missing variants and correct `url-import` to `url-token` (#8310) by @shulaoda
- mark Node.js builtin modules as side-effect-free when resolved via `external` config (#8304) by @IWANABETHATGUY
- mcs: `maxSize` should split chunks correctly based on sizes (#8289) by @hyf0

### 🚜 Refactor

- introduce `RawMangleOptions` and `RawCompressOptions` (#8366) by @sapphi-red
- mcs: refactor `apply_manual_code_splitting` into `ManualSplitter` (#8346) by @hyf0
- rolldown_plugin_vite_reporter: simplify hook registration and remove redundant state (#8322) by @shulaoda
- use set to store user defined entry modules (#8315) by @IWANABETHATGUY
- rust/mcs: collect groups into map at first for having clean and performant operations (#8313) by @hyf0
- mcs: introduce newtype `ModuleGroupOrigin` and `ModuleGroupId` (#8311) by @hyf0
- remove unnecessary `FinalizerMutableState` struct (#8303) by @shulaoda
- move module finalization into `finalize_modules` (#8302) by @shulaoda
- extract `apply_transfer_parts_mutation` into its own module (#8301) by @shulaoda
- move ESM format check into `determine_export_mode` (#8294) by @shulaoda
- remove `warnings` field from `GenerateContext` (#8293) by @shulaoda
- extract util function remove clippy supression (#8290) by @IWANABETHATGUY
- move `is_in_node_modules` to `PathExt` trait in `rolldown_std_utils` (#8286) by @shulaoda
- rolldown_plugin_vite_reporter: remove unnecessary ineffective dynamic import detection logic (#8285) by @shulaoda
- dev: inject hmr runtime to `\0rolldown/runtime.js` (#8234) by @hyf0
- improve naming in chunk_optimizer (#8287) by @IWANABETHATGUY
- simplify PostChunkOptimizationOperation from bitflags to enum (#8283) by @IWANABETHATGUY
- optimize BitSet.index_of_one to return iterator instead of Vec (#8282) by @IWANABETHATGUY

### 📚 Documentation

- change default value in `format` JSDoc from `'esm'` to `'es'` (#8372) by @shulaoda
- in-depth: remove `invalidImportSideEffects` option mention from lazy barrel optimization doc (#8355) by @sapphi-red
- mcs: clarify `minSize` constraints (#8279) by @ShroXd

### ⚡ Performance

- use IndexVec for chunk TLA detection (#8341) by @sapphi-red
- only invoke single resolve call for the same specifier and import kind (#8332) by @sapphi-red
- rolldown_plugin_vite_reporter: skip gzip computation when `report_compressed_size` is disabled (#8321) by @shulaoda

### 🧪 Testing

- use `vi.waitFor` and `expect.poll` instead of custom `waitUtil` function (#8369) by @sapphi-red
- rolldown_plugin_esm_external_require_plugin: add tests (#8358) by @sapphi-red
- add watch file tests (#8330) by @sapphi-red
- rolldown_plugin_vite_build_import_analysis: add test for dynamic import treeshaking (#8327) by @sapphi-red

### ⚙️ Miscellaneous Tasks

- prepare-release: skip workflow on forked repositories (#8368) by @shulaoda
- format more files (#8360) by @sapphi-red
- deps: update oxc to v0.114.0 (#8347) by @camc314
- deps: update test262 submodule for tests (#8354) by @sapphi-red
- deps: update crate-ci/typos action to v1.43.5 (#8350) by @renovate[bot]
- deps: update oxc apps (#8351) by @renovate[bot]
- rolldown_plugin_vite_reporter: remove unnecessary README.md (#8334) by @shulaoda
- deps: update npm packages (#8338) by @renovate[bot]
- deps: update rust crates (#8339) by @renovate[bot]
- deps: update dependency oxlint-tsgolint to v0.13.0 (#8337) by @renovate[bot]
- deps: update github-actions (#8336) by @renovate[bot]
- deps: update napi to v3.8.3 (#8331) by @renovate[bot]
- deps: update dependency oxlint-tsgolint to v0.12.2 (#8325) by @renovate[bot]
- remove unnecessary transform.decorator (#8314) by @IWANABETHATGUY
- deps: update dependency rust to v1.93.1 (#8305) by @renovate[bot]
- deps: update dependency oxlint-tsgolint to v0.12.1 (#8300) by @renovate[bot]
- deps: update oxc apps (#8296) by @renovate[bot]
- docs: don't skip for build runs without cache (#8281) by @sapphi-red
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.

[Feature Request]: add INEFFECTIVE_DYNAMIC_IMPORT warning in core

5 participants