local: npm install -D sourcemap-copy Global: npm install -g -D sourcemap-copy
Local: npx sourcemap-copy Global: sourcemap-copy
This command:
- Takes the source files in a project and copies it to a directory within the publish directory (defaults to 'dist/_src')
- Updates the .map files within the publish directory to reference the copied source files (defaults to 'dist')
It is meant for npm packages that might be imported to frameworks where sourcemap files no longer point to the right location because the original source files are not packages. However, sourcemap capability is desired in projects that import your package for future debugging.
- --quiet (-q): Suppresses all messages from this tool
- --help (h): Help section
There are configuration options to:
- Tell this tool how to go from the project root directory to the publish or 'dist' directory in relative path terms (defaults to 'dist')
- Tell this tool how to get from the root directory to the publish "src" directory in relative path terms (defaults to 'dist/_src/)
- Define the internal 'src' directory with the publish directory (defaults to '_src')
- The extension that defines a sourcemap file (defaults to '.map')
- Define the directory this tool resides in (defaults to '.')
- Tell this tool how to get from the directory this tool resides in to the project root (defaults to '.')
Note: Do not supply the ending path separators to the above configurations
The JSON default for this configuration is:
{
"rootToDist": "dist",
"distSource": "_src",
"rootToDistSrc": "dist/_src",
"allowedFileExtension": ".map",
"excluded": [
"node_modules",
"spec",
".git"
],
"utilsDirectory": ".",
"utilsToRoot": "."
}