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

Scoping a Specifier for All Dependencies in Import Maps #23612

Open
nestarz opened this issue Apr 30, 2024 · 0 comments
Open

Scoping a Specifier for All Dependencies in Import Maps #23612

nestarz opened this issue Apr 30, 2024 · 0 comments

Comments

@nestarz
Copy link

nestarz commented Apr 30, 2024

I would like to know if import maps can scope a specifier for all its dependencies.

Consider the following example:

...
  "compilerOptions": {
    "jsx": "react-jsx",
    "jsxImportSource": "react"
  },
  "scopes": {
    "https://jsr.io/@scope/my-package/0.0.0/": {
      "react/jsx-runtime": "jsr:@scope/my-package/0.0.0/react/jsx-runtime"
    }
  }

This configuration only scopes the specifier for modules that start with "https://jsr.io/@scope/my-package/0.0.0/". However, if my package at "https://jsr.io/@scope/my-package/0.0.0" imports an another JSR package, which needs the same jsx-runtime, it doesn't remap the "react/jsx-runtime" specifier for that package. I would need to add a separate scope for each dependency, which becomes cumbersome, and even so, I can't add a scope inside a scope.

Is there a way to apply the mapping for "react/jsx-runtime" not only to "@scope/my-package/0.0.0" but also to all its dependencies, without having to explicitly define a scope for each dependency? either from the deno.json, or via an app script ?

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

No branches or pull requests

1 participant