Kuoll - Source Maps
The purpose of this document is to describe how Kuoll uses Source Maps to restore original stacktraces from minified ones and improve analytics reliability.
Motivation
Many application use code minification when deploying JavaScript code to production. This minification includes changing function and variable names, rearranging code, removing whitespaces. As a result, JavaScript error stacktraces produced in a Production environment are often difficult to use. In some cases, it may lead to different errors having identical stacktraces.
To avoid this problem and to support common practice of code minification, Kuoll uses source maps to restore proper stacktraces from minified ones.
Configuring Source Maps
You only need to make sure that your minified JS files contain standard source map declaration. See the documentation for your build tool to find out how to do it.
As long as source map is available for JS file, Kuoll will find it automatically and use it to build proper stacktrace. If the source map is missing for some file, code from that particular file will not me de-minified. However, all other files will continue work as expected.
Benefits from having source maps
Whenever Kuoll has a de-minified stacktrace for some error, we will show it instead of the raw one. This de-minified stacktrace allows your developers to find the source of the error more easily.
Also, source map provides more information about the code. This information allows us to make sure we don’t mix conversion information on different errors just because they have too similar minified stacktrace.