Skip to content

[Bug]: incremental missing-module diagnostics can point at a later use instead of the import #14857

Description

@hardfist

Reproduction

The entry imports the same missing request twice:

import { first } from "./dep.js";
import { second } from "./dep.js";
console.log(first, second);

The script builds once, deletes dep.js, and compares an incremental rebuild with a cold build.

incremental rebuild after deleting dep.js: 3:13-18
cold build with dep.js missing:             1:1-34
BUG REPRODUCED: incremental location 3:13-18 differs from cold location 1:1-34.

Expected behavior

The same missing request should report a stable location regardless of whether the module graph was repaired incrementally or rebuilt cold.

Suspected area

The repair path groups affected dependencies in crates/rspack_core/src/compilation/build_module_graph/graph_updater/repair/process_dependencies.rs, while the diagnostic is assigned from create_data.dependencies[0].loc() in crates/rspack_core/src/compilation/build_module_graph/graph_updater/repair/factorize.rs. The incremental path can select a different dependency from the cold path when a group is reconstructed from affected dependency collections.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions