Skip to content

sync: retargeting a barrel's re-export (export { foo } from './a' -> './b') leaves importers on the old module #2978

Closed

Description

@inth3shadows

When a barrel's re-export points at a different module, sync() leaves the importers bound to the old module.

// a.ts  export function foo(){ return 1 }
// b.ts  export function foo(){ return 2 }
// index.ts  export { foo } from './a';
// c.ts  import { foo } from './index'; export function bar(){ return foo(); }

Index, change index.ts to export { foo } from './b';, then sync().

bar calls
after sync() a.ts:foo ✗
fresh index b.ts:foo

A reviewer run also found that export * from retargeted the same way and a scoped (watcher) sync behave the same, while a Python __init__.py re-export retarget converges. I re-ran only the named-re-export case above.

Reproduced on main at 77ee348, Linux/WSL2, Node 22.23.2, CODEGRAPH_KERNEL=0.

#2744 and #2665 cover a barrel that gains a name. Here an export that already resolved changes its source. Since c.ts didn't change and index.ts declares nothing that c.ts's edge targets, nothing marks c.ts's import for re-resolution.

Expected. When a file's re-export clauses change, re-resolve the references in files that import through it, as the gained-name case already does.

Activity

  1. colbymchenry commented on Oct 30, 2026

    @colbymchenry
    Owner

    Fixed by #3059 (from @danusha2345's #2985): codegraph sync and the file watcher now re-link the files importing through a barrel when one of its re-exports is pointed at another module, moved with export *, taken away, or loses a name. It's on main and ships in the next release. Thanks @inth3shadows for the clear report!

  2. added a commit that references this issue on Oct 30, 2026
    6644925
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions