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

[feat] Allow CLI to generate import map that bundles subdependencies #1002

Open
effulgentsia opened this issue Jan 12, 2025 · 0 comments
Open

Comments

@effulgentsia
Copy link

effulgentsia commented Jan 12, 2025

deno run -A -r https://esm.sh init
deno task esm:add react:preact/compat @radix-ui/react-slot

results in a deno.json file containing:

  "imports": {
    "@radix-ui/react-slot": "https://esm.sh/v135/*@radix-ui/[email protected]",
    "react": "https://esm.sh/v135/[email protected]/compat"
  },
  "scopes": {
    "https://esm.sh/v135/": {
      "@radix-ui/react-compose-refs": "https://esm.sh/v135/@radix-ui/[email protected]"
    }
  }

The * in the first line means that everything imported by react-slot is externalized. What I would like instead is:

  "imports": {
    "@radix-ui/react-slot": "https://esm.sh/v135/@radix-ui/[email protected]&bundle-deps&external=react",
    "react": "https://esm.sh/v135/[email protected]/compat"
  },

So that react is externalized from react-slot but other dependencies are bundled.

More generically, if I run deno task esm:add a b c, I want:

  "imports": {
    "a": "https://esm.sh/v135/a@[VERSION]&bundle-deps&external=b,c",
    "b": "https://esm.sh/v135/b@[VERSION]&bundle-deps&external=a,c",
    "c": "https://esm.sh/v135/c@[VERSION]&bundle-deps&external=a,b"    
  },

Is there configuration or command options that already allow this? If not, would there be interest in a PR that adds that?

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