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

How can I install package not used durring runtime? #762

Open
reggi opened this issue Oct 17, 2024 · 1 comment
Open

How can I install package not used durring runtime? #762

reggi opened this issue Oct 17, 2024 · 1 comment
Labels

Comments

@reggi
Copy link

reggi commented Oct 17, 2024

I created a small prettier config here:

https://jsr.io/@reggi/prettier-config

with three deps

https://jsr.io/@reggi/prettier-config/1.0.1/deno.json#L6

similar to most config modules this exports an object but also loads in the bin for prettier and a plugin which are lost in translation when looking at the npx jsr package.json

{
  "name": "@jsr/reggi__prettier-config",
  "version": "1.0.1",
  "homepage": "https://jsr.io/@reggi/prettier-config",
  "type": "module",
  "dependencies": {
    "@github/prettier-config": "^0.0.6"
  },
  "exports": {
    ".": {
      "types": "./_dist/index.d.ts",
      "default": "./index.js"
    }
  },
  "_jsr_revision": 11
}

I believe this is because jsr doesn't look at import map for deps and looks at runtime deps.

how would you solve for this edge case where you'd expect these other two packages to downloaded?

ideally not

import "npm:prettier@^3.3.3"
import "npm:@trivago/prettier-plugin-sort-imports@^4.3.0"

however that might work it's a silly pref hit

@lucacasonato
Copy link
Member

You could do if (false) import("...").

I am trying to understand more about the usecase though. Why do you need to install prettier and this config, but not rely on it. I feel like you are relying on node modules hoisting, which would break in pnpm for example.

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

No branches or pull requests

2 participants