mirror of
https://github.com/denoland/deno.git
synced 2024-11-28 16:20:57 -05:00
docs(import_maps): Fix example for project-relative absolute specifiers (#9856)
This commit is contained in:
parent
f50ed4e281
commit
7dabb3dc54
1 changed files with 5 additions and 13 deletions
|
@ -30,14 +30,15 @@ Then:
|
|||
$ deno run --import-map=import_map.json color.ts
|
||||
```
|
||||
|
||||
To use starting directory for absolute imports:
|
||||
To use your project root for absolute imports:
|
||||
|
||||
**import_map.json**
|
||||
|
||||
```jsonc
|
||||
{
|
||||
"imports": {
|
||||
"/": "./"
|
||||
"/": "./",
|
||||
"./": "./"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
@ -48,14 +49,5 @@ To use starting directory for absolute imports:
|
|||
import { MyUtil } from "/util.ts";
|
||||
```
|
||||
|
||||
You may map a different directory: (eg. src)
|
||||
|
||||
**import_map.json**
|
||||
|
||||
```jsonc
|
||||
{
|
||||
"imports": {
|
||||
"/": "./src/"
|
||||
}
|
||||
}
|
||||
```
|
||||
This causes import specifiers starting with `/` to be resolved relative to the
|
||||
import map's URL or file path.
|
||||
|
|
Loading…
Reference in a new issue