Categories
interface WriteImportMapOptions

Options for creating and writing an import map.

Examples

Example 1

import { writeImportMap, type WriteImportMapOptions } from 'jsr:@kjanat/importmapify';

const options: WriteImportMapOptions = {
  root: import.meta.dirname,
  out: '.cache/maps/import_map.json',
};

writeImportMap(options);

Properties

readonly
optional
out: PathOrUrl

Output path, resolved against root. Accepts a relative path, an absolute path, a file:// URL string, or a URL. Defaults to import_map.json.

Deno loads the written file through the importMap field in deno.json or the --import-map flag; see Deno: imports vs importMap.

readonly
optional
indent: string | number

Indentation for the serialized map, with the semantics of JSON.stringify's space parameter: a number of spaces per level or a literal indent string. Defaults to a tab.