From 6be3487f73313b8928a325c56a2f1914dada7db0 Mon Sep 17 00:00:00 2001 From: Vincent Victoria Date: Sat, 27 Jun 2020 20:52:07 +0900 Subject: docs: Update import_maps.md to include more examples (#5648) --- docs/linking_to_external_code/import_maps.md | 30 ++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) (limited to 'docs/linking_to_external_code') diff --git a/docs/linking_to_external_code/import_maps.md b/docs/linking_to_external_code/import_maps.md index 1e993dbc9..21b0477e4 100644 --- a/docs/linking_to_external_code/import_maps.md +++ b/docs/linking_to_external_code/import_maps.md @@ -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" + } +} +``` -- cgit v1.2.3