← Back to Pull requests

lib: skip source maps in node_modules by default #67627

Open
legendecas opened this pull request with 43 lines diff across 8 files
View on GitHub
legendecas legendecas commented on Nov 19, 2026 21:56 UTC
Author

This updates the flag --enable-source-maps, skipping node_modules and generated code by default.

If source map support for node_modules and generated code are needed, it can be enabled with module.setSourceMapsSupport(). This could improve general app development source map performance.

Diff: 43 lines (+37 / -6) across 8 files Reviewer: anonrig Review duration: 6928m
All Vouch review confidence checks passed
Residual risk 0.05 = Change Risk (0.36) × (1 − Review Confidence (0.85)). Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.36 · 43 lines diff across 8 files
0.36
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.80 · 5 substantive comment(s)
0.80
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 50%
85%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size diff_size
0.226
Real PR Conversation Timeline
8 items
nodejs-github-bot nodejs-github-bot commented on Nov 19, 2026 21:56 UTC
Bot

Review requested:

  • @nodejs/loaders
  • anonrig anonrig approved these changes on Nov 19, 2026 22:40 UTC
    Approved Reviewer

    Approved these changes.

    codecov[bot] codecov[bot] commented on Nov 19, 2026 23:52 UTC
    Bot

    Codecov Report


    :white_check_mark: All modified and coverable lines are covered by tests.
    :white_check_mark: Project coverage is 90.54%. Comparing base (3cac7b9) to head (ab46878).
    :warning: Report is 12 commits behind head on main.

    <details><summary>Additional details and impacted files</summary>

    @@            Coverage Diff             @@
    ##             main   #67627      +/-   ##
    ==========================================
    - Coverage   90.55%   90.54%   -0.01%     
    ==========================================
      Files         801      803       +2     
      Lines      284215   285030     +815     
      Branches    54883    55002     +119     
    ==========================================
    + Hits       257358   258091     +733     
    - Misses      17014    17095      +81     
    - Partials     9843     9844       +1     
    

    | Files with missing lines | Coverage Δ | |
    |---|---|---|
    | lib/internal/process/pre\_execution.js | 96.24% <100.00%> (-0.02%) | :arrow_down: |

    ... and 42 files with indirect coverage changes
    </details>
    <details><summary> :rocket: New features to boost your workflow: </summary>

  • :snowflake: Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

  • :package: JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

  • </details>

    mcollina mcollina requested changes on Nov 20, 2026 19:20 UTC
    Changes Requested Reviewer

    Frameworks like Next.js need source maps support to support a good debugging experience. I think if we want to do this, we need to add a CLI flag.

    Also, this might be semver-major.

    aduh95 aduh95 commented on code on Nov 20, 2026 22:52 UTC
    Code Review
    doc/api/cli.md:1
    @@ -1273,6 +1273,9 @@ is permitted.
     <!-- YAML
     added: v12.12.0
     changes:
    +  - version: REPLACEME
    +    pr-url: https://github.com/nodejs/node/pull/67627
    +    description: Source maps in `node_modules` and generated code are skipped.

    Given there's an option to unskip, it's probably a good idea add "by default"

        description: Source maps in `node_modules` and generated code are skipped by default.
    

    legendecas legendecas commented on Nov 23, 2026 19:15 UTC
    Author

    @mcollina Next.js puts their compiled app code in .next/server/..., which is outside node_modules, so the default --enable-source-maps still enables source map for app codes even with this change.

    This PR skips source map in node_modules, like Next.js's own runtime in node_modules/next/dist/compiled/..... The effect is expected to be limited, and frameworks like Next.js already hides any frame whose path includes node_modules (patch-error-inspect.ts#L228-L232).

    This PR is intended to avoid source map overhead on node_modules, which frameworks and app owners usually don't care about (as shown in next's case).

    Dug a bit, I think your point reminded me that some frameworks do depend on the generated-code bit. E.g. next.js has a non-default mode next dev --webpack that depends on eval-source-map, which relies on the generated-code source maps.

    I have reverted the --enable-source-maps to enable source maps on generated code still. And this PR is only intended to skip source maps in node_modules.

    Reviewers
    Assignees
    legendecas legendecas
    Labels
    risk: low confidence: 85.3% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 35.9% (MEDIUM) · Higher = larger blast radius
    35.9%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 85.3% · Lower = rushed or shallow review
    85.3%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 5.3% · Safe to merge
    5.3%
    Repository