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 · 2 comments
Labels
documentation Improvements or additions to documentation good first issue Good for newcomers

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?

@github-project-automation github-project-automation bot moved this to Needs Triage in JSR Oct 18, 2024
@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"
}

@lucacasonato lucacasonato added documentation Improvements or additions to documentation good first issue Good for newcomers labels Oct 25, 2024
@bp7968h
Copy link

bp7968h commented Oct 27, 2024

Hi @lucacasonato , @marvinhagemeister , @bjesuiter , this is described Here, not sure if you want to add it in publishing packages page as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation good first issue Good for newcomers
Projects
Status: Needs Triage
Development

No branches or pull requests

4 participants