diff options
Diffstat (limited to 'docs/linking_to_external_code/import_maps.md')
-rw-r--r-- | docs/linking_to_external_code/import_maps.md | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/docs/linking_to_external_code/import_maps.md b/docs/linking_to_external_code/import_maps.md index fe3a40cd2..8ed9ef891 100644 --- a/docs/linking_to_external_code/import_maps.md +++ b/docs/linking_to_external_code/import_maps.md @@ -16,27 +16,26 @@ Current limitations: Example: -```js -// import_map.json +**import_map.json** +```js { "imports": { - "http/": "https://deno.land/std/http/" + "fmt/": "https://deno.land/std@0.55.0/fmt/" } } ``` -```ts -// hello_server.ts +**color.ts** -import { serve } from "http/server.ts"; +```ts +import { red } from "fmt/colors.ts"; -const body = new TextEncoder().encode("Hello World\n"); -for await (const req of serve(":8000")) { - req.respond({ body }); -} +console.log(red("hello world")); ``` +Then: + ```shell -$ deno run --allow-net --importmap=import_map.json --unstable hello_server.ts +$ deno run --importmap=import-map.json --unstable color.ts ``` |