docs: Update import_maps.md to include more examples (#5648)

This commit is contained in:
Vincent Victoria 2020-06-27 20:52:07 +09:00 committed by GitHub
parent 6f3ad0f73a
commit 6be3487f73
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -39,3 +39,33 @@ Then:
```shell
$ deno run --importmap=import_map.json --unstable color.ts
```
To use staring directory for absolute imports:
```json
// import_map.json
{
"imports": {
"/": "./"
}
}
```
```ts
// main.ts
import { MyUtil } from "/util.ts";
```
You may map a different directory: (eg. src)
```json
// import_map.json
{
"imports": {
"/": "./src"
}
}
```