Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: the "publishing packages" page has no example 'exports' field with object syntax #767

Open
bjesuiter opened this issue Oct 18, 2024 · 1 comment

Comments

@bjesuiter
Copy link

What I see

Every Example on the page https://jsr.io/docs/publishing-packages,
and especially in the section package-config-file
only has examples like

  "exports": "./mod.ts"

What I want

An example, which shows how to use "exports" with object syntax.
Especially I want to know:
How to write the main import in object syntax?
Do I write it like this?

"exports": {
  "/": "./mod.ts"
  "/extra": "./extra/mod.ts"
}

Or like this?

"exports": {
  ".": "./mod.ts"
  "extra": "./extra/mod.ts"
}

Or something completely different?

@marvinhagemeister
Copy link
Contributor

Exporting with multiple package entries:

{
  "name": "@example/my-package",
  "exports": {
    ".": "./mod.ts",              // default entry, "@example/my-package"
    "./foo": "./src/foo.ts",      // foo entry, "@example/my-package/foo"
    "./bar": "./src/other/bar.ts" // bar entry, "@example/my-package/bar"
  }
}

Shorthand syntax for just exporting only a default entry:

{
  "name": "@example/my-package",
  "exports": "./mod.ts"
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Needs Triage
Development

No branches or pull requests

2 participants