Skip to content

Instantly share code, notes, and snippets.

@doggwang
doggwang / extract-sourcemap.mjs
Created March 31, 2026 10:50 — forked from sorrycc/extract-sourcemap.mjs
Extract original source code from JavaScript .map (source map) files. Reads sourcesContent, skips node_modules, reconstructs the original file tree.
#!/usr/bin/env node
/**
* Extract original source code from a JavaScript source map file.
*
* Usage:
* node extract-sourcemap.mjs <path-to-.map-file> [output-dir]
*
* Example:
* node extract-sourcemap.mjs cli.js.map ./src-extracted