mirror of
https://github.com/denoland/deno.git
synced 2024-12-22 23:34:47 -05:00
docs: Update import_maps.md to include more examples (#5648)
This commit is contained in:
parent
6f3ad0f73a
commit
6be3487f73
1 changed files with 30 additions and 0 deletions
|
@ -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"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
|
Loading…
Reference in a new issue