Skip to content

fix: include TypeScript source files in react-refresh-utils compilation #80531

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: canary
Choose a base branch
from

Conversation

xabierlameiro
Copy link

Fixing a bug

What?

This PR fixes VS Code debugging warnings by including TypeScript source files in the compiled @next/react-refresh-utils package.

Why?

When debugging Next.js applications in VS Code, developers encounter warnings about missing source maps because the source maps reference TypeScript files that don't exist in the compiled package. The source maps point to paths like ../../internal/ReactRefreshModule.runtime.ts but these TypeScript files are not included in the published package, causing VS Code to show "Could not read source map" warnings.

How?

Modified the ncc_react_refresh_utils function in packages/next/taskfile.js to:

  1. Copy TypeScript source files alongside JavaScript files and source maps
  2. Preserve the correct directory structure so source maps can find the referenced files
  3. Include both root-level and internal TypeScript files:
    • ReactRefreshWebpackPlugin.ts
    • loader.ts
    • runtime.ts
    • internal/ReactRefreshModule.runtime.ts
    • internal/helpers.ts

The fix is minimal and safe - it only adds the missing TypeScript source files without modifying any existing compilation logic.

Fixes #24349

Resolves missing source map warnings in VS Code by copying TypeScript
source files to the compiled @next/react-refresh-utils package. This
allows VS Code debugger to properly locate source files referenced
by source maps.

Fixes vercel#24349
@ijjk
Copy link
Member

ijjk commented Jun 14, 2025

Allow CI Workflow Run

  • approve CI run for commit: a444271

Note: this should only be enabled once the PR is ready to go and can only be enabled by a maintainer

@ijjk
Copy link
Member

ijjk commented Jun 14, 2025

Allow CI Workflow Run

  • approve CI run for commit: f8f90ea

Note: this should only be enabled once the PR is ready to go and can only be enabled by a maintainer

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Warnings when debugging in VS Code
2 participants