Skip to content

fix: resolve package subpath exports#1333

Open
pkudinov wants to merge 1 commit into
Graphify-Labs:v8from
pkudinov:codex/package-subpath-exports
Open

fix: resolve package subpath exports#1333
pkudinov wants to merge 1 commit into
Graphify-Labs:v8from
pkudinov:codex/package-subpath-exports

Conversation

@pkudinov

Copy link
Copy Markdown
Contributor

Summary

  • resolve workspace package subpath imports through package.json exports
  • support exact subpath exports such as ./browser
  • support wildcard subpath exports such as ./server/queries/*
  • prefer source-oriented conditions before runtime/type-only targets

Fixes #1308.

Verification

  • uv run pytest tests/test_js_import_resolution.py

@safishamsi

Copy link
Copy Markdown
Collaborator

Thanks @pkudinov — the extract.py change is correct and well-scoped: it handles exact subpath exports, conditional exports (source/import/require/types, source-first), and wildcard subpaths, and it's additive (export candidates are tried first, the package_dir / subpath fallback is preserved), so no regression risk to existing resolution.

The only blocker is a rebase: #1352 (npm/yarn workspaces) landed first, and both PRs added tests at the same anchor in tests/test_js_import_resolution.py, so this is now CONFLICTING. The conflict is only in the test fileextract.py auto-merges cleanly. Please rebase onto current v8 and keep both sets of tests (trivial concatenation); then CI can run and I'll merge.

Optional follow-up nit: also handle array-form export targets ("./x": ["./a.ts", "./b.ts"]), which currently return no candidates.

@pkudinov
pkudinov force-pushed the codex/package-subpath-exports branch from a67fadd to a8a81e5 Compare June 18, 2026 00:02
@pkudinov

Copy link
Copy Markdown
Contributor Author

Rebased this PR onto current v8 and resolved the test-file conflict by keeping both the npm/yarn workspace coverage and the pnpm package-subpath export coverage.

I also included the optional array-form export target handling for entries like "./x": ["./a.ts", "./b.ts"].

Verification: uv run pytest -q passed with 2098 passed, 28 skipped.

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.

TypeScript workspace imports do not resolve package subpath exports

2 participants