deno
deno copied to clipboard
deno install with import_map.json appears to be broken
I have made this third party module https://deno.land/x/wallpal. It is a cli script, so I attempted to install it with
deno install -A --import-map=https://deno.land/x/[email protected]/import_map.json https://deno.land/x/[email protected]/wallpal.ts
deno prints this output, then exits with 1
.
Download https://deno.land/x/[email protected]/[email protected]/encoding/_yaml/parse.ts
Download https://deno.land/x/[email protected]/[email protected]/encoding/_yaml/schema.ts
Download https://deno.land/x/[email protected]/[email protected]/encoding/_yaml/schema/mod.ts
Download https://deno.land/x/[email protected]/[email protected]/encoding/_yaml/stringify.ts
Download https://deno.land/x/[email protected]/[email protected]/encoding/_yaml/type.ts
Download https://deno.land/x/[email protected]/[email protected]/_util/assert.ts
Download https://deno.land/x/[email protected]/[email protected]/fs/copy.ts
Download https://deno.land/x/[email protected]/[email protected]/fs/empty_dir.ts
Download https://deno.land/x/[email protected]/[email protected]/fs/ensure_dir.ts
Download https://deno.land/x/[email protected]/[email protected]/fs/ensure_file.ts
Download https://deno.land/x/[email protected]/[email protected]/fs/ensure_link.ts
Download https://deno.land/x/[email protected]/[email protected]/fs/ensure_symlink.ts
Download https://deno.land/x/[email protected]/[email protected]/fs/eol.ts
Download https://deno.land/x/[email protected]/[email protected]/fs/exists.ts
Download https://deno.land/x/[email protected]/[email protected]/fs/expand_glob.ts
Download https://deno.land/x/[email protected]/[email protected]/fs/move.ts
Download https://deno.land/x/[email protected]/[email protected]/fs/walk.ts
Download https://deno.land/x/[email protected]/[email protected]/io/buffer.ts
Download https://deno.land/x/[email protected]/[email protected]/io/readers.ts
Download https://deno.land/x/[email protected]/[email protected]/io/streams.ts
Download https://deno.land/x/[email protected]/[email protected]/io/util.ts
Download https://deno.land/x/[email protected]/[email protected]/io/writers.ts
error: Module not found "https://deno.land/x/[email protected]/[email protected]/fs/expand_glob.ts".
at https://deno.land/[email protected]/fs/mod.ts:12:15
This project has an import map that looks like this:
{
"imports": {
"std/fs": "https://deno.land/[email protected]/fs/mod.ts",
"std/io": "https://deno.land/[email protected]/io/mod.ts",
"std/flags": "https://deno.land/[email protected]/flags/mod.ts",
"std/encoding/": "https://deno.land/[email protected]/encoding/",
"keypress/": "https://deno.land/x/[email protected]/",
"/": "./",
"./": "./"
}
}
and imports that look like
import * as fs from 'std/fs'
It seems that deno is attempting to resolve these imports as if they are local to the wallpal module. These import maps work fine locally, but they fail with deno install
, so I am inclined to believe there is a bug.
deno --version
deno 1.24.0 (release, x86_64-unknown-linux-gnu)
v8 10.4.132.20
typescript 4.7.4
found a related issue that appears to have been closed https://github.com/denoland/deno/issues/10482 and the relevant pr that supposedly fixed this behavior https://github.com/denoland/deno/pull/10499
any update on this? I am wondering if I need to rework this pr to avoid using import maps, as currently there is no good way for users to install my package
I'm running into this as well.
This being broken is sort of a big deal.
If you want to use a library that forces you to use import maps, you now give up being able to deno install
your application. 😢
Update/Tangent: I'm also a bit worried seeing the Deno team using import maps for libraries. As the ecosystem grows, if this becomes a common pattern, every consumer of a library, all the way down the dependency chain, will have to start manually maintaining a larger and larger list of mapped imports, and manually investigating which versions work with which dependencies.
Maybe a better pattern would be to depend on a default version (so avoiding import maps) and have tooling that can (optionally) override that version with import maps as necessary?
@andykais A standard way of managing your dependencies is in a deps.ts
file. See: https://deno.land/[email protected]/examples/manage_dependencies. That will let you deno install
without needing to specify an import map.