JavaScript Stack Trace Source Map Decoder

Turn errors like app.min.js:1:48213 into src/cart.ts:42:7 with the surrounding source code, using your own source maps and nothing uploaded.

Działa w Twojej przeglądarce. Twoje pliki nigdy nie opuszczają urządzenia. Zobacz, jak to sprawdzić

…

Jak to zrobić

  1. 1
    Add the source maps

    Drop or open the .map files from the same build that threw the error, or paste a map, or open a script with an inline map.

  2. 2
    Paste the stack trace

    Copy the trace from the console, an error report or a log file into the stack trace box.

  3. 3
    Check the matches

    The counters show how many frames were found and mapped; a note lists script names that no map matched.

  4. 4
    Read the original code

    Each mapped frame shows the original file, line and column, with the code around it and a caret under the column.

  5. 5
    Adjust the view

    Change the number of context lines, hide unmapped frames, or switch the rewritten trace between Chrome and Firefox style.

  6. 6
    Copy the result

    Copy or download the rewritten trace and paste it into your issue tracker.

O tym narzędziu

Production JavaScript is bundled and minified, so the stack traces you get from error reports, browser consoles and log files point at line 1 of a file such as app.3f9a1c.min.js, at column 48,213, inside a function called e or t. That position is real but useless for debugging. A source map is the file the bundler writes next to the bundle that records, for every piece of the minified output, which original file, line and column it came from. This decoder reads those maps and does the lookup for you. Paste the trace as it appears in Chrome, Edge, Node.js, Firefox or Safari: the at fn (url:line:col) form and the fn@url:line:col form are both understood, including anonymous frames, async frames and constructor calls. Add one or more .map files, paste the JSON, or open a minified script that carries an inline base64 map in its sourceMappingURL comment. Each frame is matched to a map by the map's file field or by the map's own name, and with a single map it is used for every frame. The Base64 VLQ mappings are decoded fully, index maps with sections are supported, and the lookup uses the same greatest-lower-bound rule as the Mozilla source-map library, so the result matches what browser developer tools show. When the map contains sourcesContent you also see the original code around the line, with the column marked by a caret. A rewritten trace with original paths is ready to copy into a bug report.

Where to find the map files

Most bundlers only write maps when asked. In Vite set build.sourcemap, in webpack set devtool to source-map or hidden-source-map, in esbuild pass --sourcemap, and in Next.js set productionBrowserSourceMaps. Hidden maps are the safest choice for production: the .map files are generated but the bundle does not link to them, so visitors cannot download your source while you can still decode traces.

Why a frame is not mapped

A frame stays unmapped when no loaded map matches its file name, when the column falls before the first mapping on that line, or when the map was built from a different version of the code. Maps must come from exactly the same build as the bundle that produced the error; even a one-character change shifts every column after it. Third-party scripts such as analytics tags or browser extensions usually have no map you can use.

Names in the result

The function name shown first is the one from the trace. When the map records an original identifier at the mapped position, it is shown as the original symbol. At a call site that is often the name of the function being called rather than the function you are in, which is how the source map format works.

Limits

This tool does not fetch maps or scripts from the internet; open the files you have. It does not deobfuscate code that was never mapped and it does not guess names. Everything runs in your browser tab and no code is uploaded.

Przykład z rozwiązaniem

A checkout page reports TypeError at app.3f9a1c.min.js:1:122 inside renderCart. After opening app.3f9a1c.min.js.map (2 sources, 3 mappings in this small example) the frame resolves to ../src/cart.ts line 6, column 15, the throw new TypeError statement, with lines 3 to 9 shown around it. The second frame at column 322 resolves to ../src/main.ts line 4, column 20, where renderCart is called inside the click handler. The vendor.81b2.min.js frame stays unmapped because no map for it was loaded, and the rewritten trace keeps its original location.

W skrócie

Najczęstsze pytania

Which stack trace formats are supported?

The V8 format used by Chrome, Edge, Opera and Node.js (lines starting with at), and the format used by Firefox and Safari (function@url:line:column). Lines that are not frames, such as the error message, are kept as they are in the rewritten trace.

Do I need the original source files?

No. You need the .map files. If the bundler embedded the original code in the map (the sourcesContent field, which most do by default), you also see the code around each line. Without it you still get the file, line and column.

Can I decode traces from several bundles at once?

Yes. Load every map you have, for example the main bundle, a vendor chunk and a lazy-loaded route. Each frame is matched to the map whose file field or file name equals the script name in the trace.

Why are line numbers different from what my editor shows for the minified file?

Traces use 1-based lines and columns, while source maps store 0-based positions internally. The decoder converts between them, so the original line and column shown are the 1-based numbers you see in your editor.

Does it work with TypeScript, Vue, Svelte and React projects?

Yes. Any tool that writes standard version 3 source maps works, including tsc, Babel, esbuild, Rollup, Vite, webpack, Parcel, SWC and Terser. Maps chained through several tools are fine as long as the bundler composed them into one final map.

Is my code sent to a server?

No. Maps and traces are parsed by JavaScript in your browser tab. You can disconnect from the internet after the page has loaded and the decoder keeps working.

Całkowicie za darmoBez opłat i rejestracji
Pliki zostają prywatneWszystko działa w Twojej przeglądarce
Łatwo w Twoim językuDostępne w wielu językach