docs(import_maps): Fix example for project-relative absolute specifiers (#9856)

This commit is contained in:
Nayeem Rahman 2021-03-22 20:13:50 +00:00 committed by GitHub
parent 870337c6cd
commit 26f7a3f185
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 13 deletions

View File

@ -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.