Skip to main content
Moderne OnlyThis recipe is proprietary to Moderne and runs on the Moderne platform or CLI — it isn’t part of the open-source catalog. Available with a Moderne subscription.Contact Sales

Replace source-map-support/register with --enable-source-maps in package.json

Recipe IDorg.openrewrite.node.migrate.source-map-support.replace-source-map-support-register-in-package-json
Artifact@openrewrite/recipes-nodejs

Replaces -r source-map-support/register with Node's --enable-source-maps flag in package.json scripts that run node or mocha, including through nyc, c8 or cross-env. Mocha's require list (in package.json or .mocharc.json) gets "enable-source-maps": true, which mocha forwards to Node, and ava's require list nodeArguments: ["--enable-source-maps"]. Jest setupFiles entries are dropped, since Jest maps stack traces itself. Scripts running other tools are left alone.

Single recipeOpenRewritesource-map-supportModerne Proprietary License
Try in PlatformTry this recipe in the Moderne platform. Not a user yet? You’ll get a no-setup demo environment, with nothing to install or configure.

Usage​

Run this recipe

In order to run JavaScript recipes, you will need to use the Moderne CLI. For JavaScript specific configuration instructions, please see our configuring JavaScript guide.

Once the CLI is installed, you can install this JavaScript recipe package by running the following command:

Install the recipe package
mod config recipes npm install @openrewrite/recipes-nodejs

Then, you can run the recipe via:

Run the recipe
mod run . --recipe org.openrewrite.node.migrate.source-map-support.replace-source-map-support-register-in-package-json