#14855·rspack

[Bug]: incremental rebuild does not restore a side-effect-only import after sideEffects is re-enabled

Author: hardfistCreated Jul 20, 2026Updated Sep 10, 2026

Reproduction

The repro uses one compiler instance with incremental make enabled and changes a package metadata file between builds:

  1. sideEffects: true — the side-effect marker is present.
  2. sideEffects: false — the side-effect-only import is removed.
  3. sideEffects: true again — the incremental bundle still omits the marker.
  4. A cold build with sideEffects: true includes the marker again.

Observed output:

incremental: initial sideEffects=true  marker=true
incremental: sideEffects=false         marker=false
incremental: sideEffects=true again    marker=false
cold: final sideEffects=true           marker=true
BUG REPRODUCED: the incremental bundle stays stale after re-enabling side effects.

Expected behavior

Changing package sideEffects metadata back to true should make the incremental result match a cold build and retain the side-effect-only module.

Suspected area

The stale state appears to cross the make/finish/optimize boundary used for side-effect connection evaluation. Relevant code paths are crates/rspack_core/src/artifacts/side_effects_state_artifact.rs, crates/rspack_core/src/compilation/finish_modules/mod.rs, and crates/rspack_core/src/compilation/build_module_graph/graph_updater/repair/lazy.rs.

The repository contains the complete runnable fixture and a cold-build control.