Skip to content

fix: correct exports field to use subpath "." with import condition#211

Open
trim21 wants to merge 1 commit into
webtorrent:masterfrom
trim21:fix/exports-field
Open

fix: correct exports field to use subpath "." with import condition#211
trim21 wants to merge 1 commit into
webtorrent:masterfrom
trim21:fix/exports-field

Conversation

@trim21

@trim21 trim21 commented Jul 18, 2026

Copy link
Copy Markdown

The current exports field:

"exports": {
  "import": "./index.js"
}

Treats "import" as a subpath (bencode/import), not as a condition. The package root entry point (import "bencode") is left undefined because there is no "." subpath.

This PR wraps the condition inside "." so that "import" becomes a proper condition on the root export:

"exports": {
  ".": {
    "import": "./index.js"
  }
}

This correctly declares an ESM-only package root entry while keeping the same restriction.

The previous object form {"import": "./index.js"} treated "import"
as a subpath (bencode/import) rather than a condition, leaving the
package root entry point undefined. Wrapping it inside "." makes
"import" a proper condition on the root export.
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