To debug your code in the production environment, relying on the error stack trace may be challenging as the code is usually minified. However, you can upload the source maps to Quickloop, which helps map the stack trace back to the original source code, making debugging easier.
Quickloop provides a CLI for you to quickloop upload and remove all generated source maps in the production environment. To install, run:
npm install -g @quickloop/cli
Once the CLI has been installed, run this command in your repository:
qloop sourcemaps upload --apiKey=<YOUR API KEY> --remove --dir <YOUR SOURCEMAPS DIRECTORY>
--apiKey
- The REST API Key of your account. Note that, this is different than the SDK Key you use in your <script>
tag.--dir
- The directory where your source maps are located. Default ./dist
.--remove
- Tell the CLI to remove all the source maps after uploading. This is recommended in your production environment.JUST KIDDING! That’s all you need to do to have more meaningful stack traces in the tickets.
Once your source maps are uploaded, you can go to any console log of the ticket and click View stack traces to print the stack trace of the original source code.