---
title: "ezgh obs sourcemaps inject"
description: "Give each JS file in a build and its source map a debug ID."
---

> Documentation Index
> Fetch the complete documentation index at: https://docs.ezghcloud.com/llms.txt
> Use this file to discover all available pages before exploring further.

# ezgh obs sourcemaps inject

{/* Generated by ezgh-cli's internal/tools/clidocs from the ezgh command tree. Don't edit: change the command's help in ezgh-cli and regenerate. */}

```sh
ezgh obs sourcemaps inject <dir> [--dry-run] [flags]
```

Give each JS file in a build directory and its source map a debug ID, so errors from that file can be symbolicated with that map. Each .js, .mjs and .cjs file (not in node_modules) is paired with the map its trailing //# sourceMappingURL comment names, else &lt;file&gt;.map. ezgh adds a one-line registration snippet after the file's directives and a //# debugId=&lt;id&gt; comment, shifts the map's mappings to match, and sets the map's debugId. The ID is derived from the files' content, and a file already injected is left alone, so running inject again is safe.

Run it after your build and before deploying and `upload`ing: the files must ship with the snippet. Files are rewritten in place (`--dry-run` writes nothing). A JS file without a map is skipped. A pair that can't be injected (an index map, two different debug IDs) fails the command after the others are done.

Part of [`ezgh obs sourcemaps`](/cli/reference/obs-sourcemaps).

## Examples

```sh
ezgh obs sourcemaps inject dist
ezgh obs sourcemaps inject dist --dry-run
```

## Flags

| Flag | Type | Default | Description |
| --- | --- | --- | --- |
| `--dry-run` | boolean |  | show what would be injected, and write nothing |

This command also takes the [global flags](/cli/reference#global-flags).

Source: https://docs.ezghcloud.com/cli/reference/obs-sourcemaps-inject/index.mdx
