parseImportMap() function

Read an import map from its generator-option spelling.

Signature:

export declare function parseImportMap(spec?: string): ImportMap;

Parameters

Parameter

Type

Description

spec

string

(Optional) The option value, or undefined for no redirection.

Returns:

ImportMap

The parsed map.

Exceptions

When an entry is malformed or names an unknown specifier.

Remarks

"zod=@my-org/runtime, @imqueue/rpc=@my-org/runtime". An entry naming a specifier this package never emits is a throw rather than a no-op: silently ignoring it would leave the consumer believing a redirection had been applied when the generated files still point at the original.

Example

parseImportMap('zod=@my-org/runtime');
// { zod: '@my-org/runtime' }

Read this page as plain markdown — no HTML, no navigation. For pasting into an LLM, or for an agent to fetch.