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

Enable native source maps at launch and drop source-map-support

Recipe IDorg.openrewrite.node.migrate.source-map-support.enable-source-maps-at-launch
Artifact@openrewrite/recipes-nodejs

Where source-map-support is installed too late for process.setSourceMapsEnabled(true) to stand in for it — in an ES module, every import is evaluated before any statement runs, so the call would only map what loads after it — this puts --enable-source-maps on whatever launches the process instead, which Node applies before the first module loads. The flag goes into the package's bin shebang (as #!/usr/bin/env -S node --enable-source-maps) and into any package.json script that runs node or mocha directly. The install() call and register import are then redundant and are removed, rather than replaced by a call that would map less. A package with no launcher this recipe can reach is left alone and reported by FindSourceMapSupportManualMigrations.

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.enable-source-maps-at-launch