Skip to content

fix(import_resolver): fall back to element source URI when no library re-exports it#74

Open
pcj wants to merge 1 commit into
Stacked-Org:mainfrom
pcj:fix/resolver-fallback-source-uri
Open

fix(import_resolver): fall back to element source URI when no library re-exports it#74
pcj wants to merge 1 commit into
Stacked-Org:mainfrom
pcj:fix/resolver-fallback-source-uri

Conversation

@pcj

@pcj pcj commented Jun 16, 2026

Copy link
Copy Markdown

ImportResolver.resolve returned null when no library in libs re-exports the element, even though the element's own source URI is always a valid Dart import. This stranded callers like dependency_config_factory with no way to produce a working import for the element.

Under standard build_runner, libs is the full transitive package graph and the original loop almost always matched, so the null path was rarely hit. Under Bazel's rules_dart codegen action, libs is each package's src/ libraries only (not the public re-exporting library), so the loop fails to match for types like StackedService and codegen emits broken imports.

Falling back to the element's source URI is harmless under build_runner (unreachable) and unblocks Bazel + any other host with a similar library scope.

… re-exports it

ImportResolver.resolve returned null when no library in libs re-exports
the element, even though the element's own source URI is always a valid
Dart import. This stranded callers like dependency_config_factory with no
way to produce a working import for the element.

Under standard build_runner, libs is the full transitive package graph
and the original loop almost always matched, so the null path was rarely
hit. Under Bazel's rules_dart codegen action, libs is each package's
src/ libraries only (not the public re-exporting library), so the loop
fails to match for types like StackedService and codegen emits broken
imports.

Falling back to the element's source URI is harmless under build_runner
(unreachable) and unblocks Bazel + any other host with a similar library
scope.
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.

1 participant