diff options
author | Bartek IwaĆczuk <biwanczuk@gmail.com> | 2021-07-20 16:25:36 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-07-20 16:25:36 +0200 |
commit | d744c0c6d9a557bbaa2a23571ffb3acabf19c35a (patch) | |
tree | 6f7fb8a71b786e79c48f4b2c11a5a9ca988717e8 /docs/linking_to_external_code/import_maps.md | |
parent | 9b9becf1ae256b645e37a7eecf3441f3ae4b8ea5 (diff) |
chore: move docs to separate repository
Diffstat (limited to 'docs/linking_to_external_code/import_maps.md')
-rw-r--r-- | docs/linking_to_external_code/import_maps.md | 53 |
1 files changed, 0 insertions, 53 deletions
diff --git a/docs/linking_to_external_code/import_maps.md b/docs/linking_to_external_code/import_maps.md deleted file mode 100644 index 881c3cb74..000000000 --- a/docs/linking_to_external_code/import_maps.md +++ /dev/null @@ -1,53 +0,0 @@ -## Import maps - -Deno supports [import maps](https://github.com/WICG/import-maps). - -You can use import maps with the `--import-map=<FILE>` CLI flag. - -Example: - -**import_map.json** - -```js -{ - "imports": { - "fmt/": "https://deno.land/std@$STD_VERSION/fmt/" - } -} -``` - -**color.ts** - -```ts -import { red } from "fmt/colors.ts"; - -console.log(red("hello world")); -``` - -Then: - -```shell -$ deno run --import-map=import_map.json color.ts -``` - -To use your project root for absolute imports: - -**import_map.json** - -```jsonc -{ - "imports": { - "/": "./", - "./": "./" - } -} -``` - -**main.ts** - -```ts -import { MyUtil } from "/util.ts"; -``` - -This causes import specifiers starting with `/` to be resolved relative to the -import map's URL or file path. |