1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-11-30 16:40:57 -05:00

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 Kitson Kelly
parent f50ed4e281
commit 7dabb3dc54
No known key found for this signature in database
GPG key ID: 2D87CFF11B51960A

View file

@ -30,14 +30,15 @@ Then:
$ deno run --import-map=import_map.json color.ts $ 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** **import_map.json**
```jsonc ```jsonc
{ {
"imports": { "imports": {
"/": "./" "/": "./",
"./": "./"
} }
} }
``` ```
@ -48,14 +49,5 @@ To use starting directory for absolute imports:
import { MyUtil } from "/util.ts"; import { MyUtil } from "/util.ts";
``` ```
You may map a different directory: (eg. src) This causes import specifiers starting with `/` to be resolved relative to the
import map's URL or file path.
**import_map.json**
```jsonc
{
"imports": {
"/": "./src/"
}
}
```