← All recipes
Moderne licensed

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-jsonArtifact@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 recipesource-map-supportProprietary

Usage

This recipe has no required configuration options. You’ll need the Moderne CLI configured before running the command below.

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

If the recipe isn’t available locally, install it with:

mod config recipes npm install @openrewrite/recipes-nodejs