# JavaScript source maps

DevFeed: [JavaScript source maps](<https://devfeed.tech/articles/javascript-source-maps-51507.md>)

Original publisher: [Read original article](<https://gleam.run/news/javascript-source-maps>)

Author: Louis Pilfold

Published: 2026-04-24T00:00:00Z

Content type: release

Language: en

Sources: [Gleam](<https://devfeed.tech/sources/gleam.md>)

Topics: [Compilers and Linkers](<https://devfeed.tech/topics/compilers-and-linkers.md>), [JavaScript](<https://devfeed.tech/topics/javascript.md>), [Developer Tools](<https://devfeed.tech/topics/developer-tools.md>), [Erlang](<https://devfeed.tech/topics/erlang.md>), [typesafety](<https://devfeed.tech/topics/typesafety.md>), [Build tool](<https://devfeed.tech/topics/build-tool.md>), [browser](<https://devfeed.tech/topics/browser.md>), [Transpilers](<https://devfeed.tech/topics/transpilers.md>), [IntelliJ IDEA](<https://devfeed.tech/topics/intellij-idea.md>)

Tags: [breakpoint](<https://devfeed.tech/tags/breakpoint.md>), [browser](<https://devfeed.tech/tags/browser.md>), [browsers](<https://devfeed.tech/tags/browsers.md>), [debug](<https://devfeed.tech/tags/debug.md>), [debuggers](<https://devfeed.tech/tags/debuggers.md>), [debugging](<https://devfeed.tech/tags/debugging.md>), [dev-tools](<https://devfeed.tech/tags/dev-tools.md>), [exception](<https://devfeed.tech/tags/exception.md>), [javascript](<https://devfeed.tech/tags/javascript.md>), [maps](<https://devfeed.tech/tags/maps.md>), [safari](<https://devfeed.tech/tags/safari.md>), [source](<https://devfeed.tech/tags/source.md>)

## AI overview

Gleam v1.16.0 adds JavaScript source maps so browser tools can show original Gleam locations in code, stack traces, and debugging sessions; enable them with `javascript.source_maps = true` and serve the generated map files. Serving the build directory or using Lustre's dev-tools already handles that. The release also improves language-server fault tolerance by reporting imports that lead to compilation failures and continuing with compilable module branches. Other changes include nearly 30% faster single-character string-prefix matching in the cited `glance` benchmark, a warning for JavaScript integer patterns wider than its 52-bit precision limit, package owner management, and additional code actions and compiler improvements.

## Source excerpt

Gleam is a type safe and scalable language for the Erlang virtual machine and JavaScript runtimes. Today Gleam v1.16.0 has been published, let's go over what's new. Gleam gets source maps Gleam's robust type system makes runtime errors very rare, but it would be naive to say that it's never necessary to debug Gleam code at runtime. When compiling code to JavaScript one challenge for runtime debugging is that the error and the source code shown is that of the compiled JavaScript, not the Gleam the programmer actually wrote. The solution to this problem is source maps, additional files that Gleam's compiler can now generate, teaching browsers and JavaScript runtimes what the original code is and how it maps on to the JavaScript it runs. Here it is in action with Safari's dev-tools: As you may know, it's not limited to just displaying the code, it also translates exception stack traces to the original locations, and enables use of breakpoints and debuggers. To enable source maps set the javascript.source_maps property to true in your gleam.toml, and ensure that you are serving these new files to the web browser along with your JavaScript code. If you are serving the build directory or using Lustre's dev-tools then there's nothing else to do. name = "my_project" version = "1.0.0" [javascript] source_maps = true [dependencies] gleam_stdlib = ">= 1.0.0 and < 2.0.0" A huge thank you to Ameen Radwan for this big improvement. Folks who enjoy breakpoint debugging will be especially pleased. Package-level fault tolerance Gleam is a fully-typed language, so to compile a module of Gleam code the compiler must first successfully compile all the modules it imports in order to have the required type information. Attempting to analyse modules without this information would result in a cascading failure of incorrect and misleading error messages, so when a module cannot be compiled the build tool stops and reports the errors. This behaviour successfully prevents the error cascade, bu