summaryrefslogtreecommitdiff
path: root/website/manual.md
diff options
context:
space:
mode:
Diffstat (limited to 'website/manual.md')
-rw-r--r--website/manual.md45
1 files changed, 45 insertions, 0 deletions
diff --git a/website/manual.md b/website/manual.md
index 08ac60ab7..684d44c2e 100644
--- a/website/manual.md
+++ b/website/manual.md
@@ -634,6 +634,7 @@ OPTIONS:
--allow-read=<allow-read> Allow file system read access
--allow-write=<allow-write> Allow file system write access
-c, --config <FILE> Load compiler configuration file
+ --importmap <FILE> Load import map file
--v8-flags=<v8-flags> Set V8 command line options
SUBCOMMANDS:
@@ -676,6 +677,50 @@ Particularly useful ones:
--async-stack-trace
```
+## Import maps
+
+Deno supports [import maps](https://github.com/WICG/import-maps).
+
+One can use import map with `--importmap=<FILE>` CLI flag.
+
+Current limitations:
+
+- single import map
+- no fallback URLs
+- Deno does not support `std:` namespace
+- Does supports only `file:`, `http:` and `https:` schemes
+
+Example:
+
+```js
+// import_map.json
+
+{
+ "imports": {
+ "http/": "https://deno.land/std/http/"
+ }
+}
+```
+
+```ts
+// hello_server.ts
+
+import { serve } from "http/server.ts";
+
+async function main() {
+ const body = new TextEncoder().encode("Hello World\n");
+ for await (const req of serve(":8000")) {
+ req.respond({ body });
+ }
+}
+
+main();
+```
+
+```bash
+$ deno run --importmap=import_map.json hello_server.ts
+```
+
## Internal details
### Deno and Linux analogy