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

deno vendor does not work with existing import map with bare specifier mapping #13697

Closed
lucacasonato opened this issue Feb 16, 2022 · 4 comments · Fixed by #14836
Closed

deno vendor does not work with existing import map with bare specifier mapping #13697

lucacasonato opened this issue Feb 16, 2022 · 4 comments · Fixed by #14836
Labels
feat new feature (which has been agreed to/accepted) vendor related to the vendor subcommand

Comments

@lucacasonato
Copy link
Member

~/p/g/d/d/test ❯❯❯ cat import_map.json
{
  "imports": {
    "std/": "https://deno.land/[email protected]/"
  }
}
~/p/g/d/d/test ❯❯❯ cat main.ts 
import "std/examples/welcome.ts";
~/p/g/d/d/test ❯❯❯ deno vendor --import-map import_map.json main.ts -f
Vendored 1 module into vendor/ directory.

To use vendored modules, specify the `--import-map` flag when invoking deno subcommands:
  deno run -A --import-map vendor/import_map.json main.ts
~/p/g/d/d/test ❯❯❯ deno run -A --import-map vendor/import_map.json main.ts
error: Relative import path "std/examples/welcome.ts" not prefixed with / or ./ or ../ and not in import map from "file:///mnt/starship/Projects/github.com/denoland/dotcom/test/main.ts"
    at file:///mnt/starship/Projects/github.com/denoland/dotcom/test/main.ts:1:8
@lucacasonato lucacasonato added bug Something isn't working correctly cli related to cli/ dir labels Feb 16, 2022
@dsherret
Copy link
Member

I added this later to the PR description:

The specified import map is not combined with the generated import map. It might be hard to do this correctly because the base of the import map changes when going into the vendor folder. Right now it's not a big deal for people to manually update the created import map after.

#13670

The recommended thing to do atm is update the new import map manually.

@kitsonk kitsonk added vendor related to the vendor subcommand and removed cli related to cli/ dir labels Feb 16, 2022
@lucacasonato
Copy link
Member Author

lucacasonato commented Feb 16, 2022

I think we should try to do this in the future. Manually combining every time you run deno vendor doesn't sound like much fun.

@lucacasonato lucacasonato added feat new feature (which has been agreed to/accepted) and removed bug Something isn't working correctly labels Feb 16, 2022
@jimisaacs
Copy link

I ended up writing this for now:
https://github.com/jimisaacs/source_vendor_import_map_fix_up

@jimisaacs
Copy link

I'd like to suggest going on a walk through the README at that link.

It might be a rudimentary untested implementation, but the example should give a good idea of why I wrote that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feat new feature (which has been agreed to/accepted) vendor related to the vendor subcommand
Projects
None yet
4 participants