Skip to content

createIgnoreListOnlySourceMap

Builds a minimal source map that maps only the generated code coming from an ignore-listed source.

Everything else stays unmapped, so DevTools keeps linking it to the generated script as it does with no source map at all, and only the ignore-listed regions change: DevTools skips them when it picks a message’s location. The map has no sourcesContent and no names, and one segment per region boundary, so it adds little to a minified bundle.

Measured in Chrome’s own DevTools: a script whose map lists ONLY ignore-listed sources still links its unmapped frames to itself, so the plugin’s own messages keep pointing at the plugin.

Import:

import { createIgnoreListOnlySourceMap } from '@mnaoumov/obsidian-dev-toolkit/bundlers/esbuild-impl/ignore-list-source-map-plugin';

Signature:

function createIgnoreListOnlySourceMap(sourceMap: SourceMap, getListedSourceName: (source: string) => string | null): SourceMap | null

Parameters:

Parameter Type Description
sourceMap SourceMap The full source map of the bundle.
getListedSourceName (source: string) => string | null Returns the name an ignore-listed source is listed under, or null for a source that is not ignore-listed. Sources listed under a name other than their own are merged into one, and map to its start.

Returns: SourceMap | null — The minimal source map, or null when no generated code comes from an ignore-listed source.


Links to this page: