drom765D
Denoβ€’2y agoβ€’
2 replies
drom765

About imports

Hi, I'm new to Deno and looking for answers regarding imports.

1.
deno add @org/package
registers the package at
deno.jsonc.imports
even if
import_maps.json
is present. Can this be configured, or is Deno moving away from placing import aliases in a separate file? On one hand, having a separate file seems maintainable; on the other, the import map is kind of a Deno "feature."

2. The documentation at https://deno.land/std@0.224.0 suggests that I should avoid using
*
when importing only one function (
import * as fs from "https://deno.land/std@0.224.0/fs/mod.ts";
). However, since version 1.5, Deno does tree-shaking, making this seem irrelevant. Is this correct?

3. Should I avoid or update imports from
deno.land/
and use
jsr
packages exclusively? The latter seems friendlier to me because I find it cumbersome to look up which file I need within a package (sometimes it's specific like
.../assert.ts
, sometimes
.../mod.ts
). Are there any important packages/code that aren't on
jsr
but are present on
deno.land
?

4. The documentation mentions the
$
convention for std (only), yet I didn't find any packages, even official ones, using it. Is my iteration on
$
confusing? (
"$assert": "jsr:@std/assert@^1.0.0"
)

5. Is there a benefit to importing modules directly in the source code rather than using an import map in general?
Was this page helpful?