Skip to content

Investigate source-map-support #215

@hamish-milne

Description

@hamish-milne

The above package, which is still the top search result for 'node source map support', hasn't been relevant for most users since Node 12, which brought native source map support to the platform.

While the maintainer does state as much in the readme, the trend is concerning, with downloads tripling to 70 million over the period, 5 years, from which it should have ceased to be relevant.

As the readme states, the preferred solution is:

  • Pass --enable-source-maps as an argument, or
  • Set NODE_OPTIONS=--enable-source-maps

TODO: For dev tools, is it possible to set the bin field in package.json to do this? Could it be done with a simple shell script shim?

EDIT: Yes! In fact all that's needed is to add the argument to the shebang line, e.g. #!/usr/bin/env node --enable-source-maps. The node exec/npx command understands this even on Windows.

The few cases where you really need this are:

  • node:vm, which doesn't let you specify this option externally (so, test runners might still need it);
  • serverless deployments, where you might not have control over how the runtime gets loaded (though in that case it should be done by the application code, not any other dependency); and
  • where you have pledged to support node versions lower than 12 (which we would encourage everyone to stop doing anyway)

Top consumers are:

# Downloads Traffic Version Package
1 163.78M 4364.77 GB ~0.5.20 terser
2 135.21M 3603.37 GB 0.5.13 jest-runner
3 32.45M 864.77 GB ^0.5.16 @babel/register
4 13.53M 360.58 GB 0.5.19 @nx/js
5 12.46M 332.01 GB 0.5.21 @angular-devkit/build-angular
6 12.03M 320.51 GB ^0.5.5 karma-source-map-support
7 9.96M 265.56 GB 0.5.21 @angular/build
8 9.13M 243.22 GB 0.5.21 pm2
9 8.47M 225.60 GB ^0.5.21 @swc-node/sourcemap-support
10 7.97M 212.38 GB ^0.4.15 babel-register
11 7.51M 200.21 GB ~0.5.21 @expo/cli
12 6.99M 186.25 GB ^0.5.21 @esbuild-kit/core-utils
13 6.27M 167.21 GB ^0.5.21 @cucumber/gherkin-utils
14 5.37M 143.10 GB ^0.5.12 ts-node-dev
15 5.31M 141.56 GB 0.5.21 @cucumber/gherkin-streams
16 5.17M 137.76 GB ^0.x teen_process
17 4.32M 115.22 GB ^0.5.21 @netlify/functions
18 3.61M 96.13 GB ^0.5.6 @pulumi/pulumi
19 3.24M 86.26 GB 0.5.21 @appium/support
20 3.18M 84.77 GB 0.5.21 @appium/schema

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions