Add a unit test for plain package subpath resolution

A plain package subpath now lands on the same resolver target as its
bare import.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
ayushcodes10andClaude Sonnet 5 committed 2026-09-16 15:04:59 +05:30
1 parent be0eb7f2a5
commit b703d3126e
1 file changed
+12
+12
View File
@@ -48,6 +48,18 @@ def test_scoped_package_import_is_ref_namespaced():
assert tgt.startswith("ref")
# ── #3595: a package subpath import must resolve to the package root, not the ─
# whole specifier, so it lands on the same node as a bare import of that
# package (and the package.json dependency node itself) instead of dangling.
def test_package_subpath_import_resolves_to_the_same_target_as_a_bare_import():
bare_tgt, _ = _resolve_js_import_target("next", "src/bare.ts")
subpath_tgt, resolved_path = _resolve_js_import_target("next/image", "src/subpath.ts")
assert resolved_path is None
assert subpath_tgt == bare_tgt
# ── end-to-end: the reporter's exact synthetic monorepo ─────────────────────