source-map-support
's direct dependencies. Data on all dependencies, including transitive ones, is available via CSV download.Name | Version | Size | License | Type | Vulnerabilities |
---|---|---|---|---|---|
buffer-from | 1.1.2 | 2.26 kB | MIT | prod | |
source-map | 0.6.1 | 194.96 kB | BSD-3-Clause | prod |
Source-map-support is a handy Node.js module that enhances stack trace readability for JavaScript products that are compiled from languages like TypeScript, CoffeeScript, or other languages that get compiled into JavaScript. The primary role of this module is to map the stack trace errors back to the original source code, effectively utilizing the source maps. The transformation in turn replaces the paths and line numbers of the source-mapped files with the original paths and line numbers, making the stack trace more understandable and indicative of where exactly issues exist.
To use source-map-support in your Node.js project, you should first install it using the npm package manager. Open your terminal or command line and enter the command npm install source-map-support
.
After successfully installing the package, you can use it programmatically or via the command-line interface (CLI).
For CLI usage:
Run your JavaScript file with Node and register the source-map-support module by appending -r source-map-support/register
For instance: node -r source-map-support/register compiled.js
In case you want to use it programmatically, you need to include the following at the top of your compiled file:
require('source-map-support').install();
Alternatively, to directly install source-map support, import the register
module as follows:
import 'source-map-support/register'
// Instead of:
import sourceMapSupport from 'source-map-support'
sourceMapSupport.install()
The comprehensive documentation for the source-map-support package is situated within the README.md file within the root folder of its GitHub repository. The documentation can be visited at the following URL: https://github.com/evanw/node-source-map-support. This contains exhaustive details on installation, usage, options, and demonstrations for a range of usage scenarios. It's an indispensable resource for understanding the package in more depth before integrating it into your project.