Appearance
Automatic source map resolution
When your code is minified for production, stack traces reference minified file names and line numbers. Vantmetry resolves these back to your original source automatically, with no upload step and no build plugin.
How resolution works
The ingestor looks for the //# sourceMappingURL= comment at the end of your JavaScript file. If there is none, it tries fetching the same URL with .map appended. Fetched maps are cached, and lookups that fail are also cached, so your servers are not hammered by repeated requests. When no map can be obtained, the original minified stack trace is shown unchanged.
The requirement
The ingestor must be able to fetch the .map files over HTTP from the same location as the JavaScript. If the maps are not deployed at all, stack traces stay minified.
Hidden source maps work
A deployed .map file without the sourceMappingURL comment (for example Vite's sourcemap: 'hidden') still resolves through the .map-suffix fallback. This lets you ship readable stack traces without advertising the map URL inside your JavaScript bundle. It is the recommended middle ground for teams that do not want the map URL public in their code.
Emitting production source maps
Enable production source maps in your bundler. Both the visible and hidden variants work with Vantmetry.
webpack
javascript
module.exports = {
devtool: 'source-map', // or 'hidden-source-map'
};Next.js
In next.config.js:
javascript
module.exports = {
productionBrowserSourceMaps: true,
};Vite, Vue, SvelteKit
In vite.config.ts:
typescript
export default defineConfig({
build: {
sourcemap: 'hidden', // or true to also include the pragma comment
},
});Angular CLI
In the production build options of angular.json:
json
{
"sourceMap": true
}Or build with the flag directly:
bash
ng build --source-map