Skip to content

Comments

fix(SSR): ESM source map in VM#7052

Merged
chenjiahan merged 5 commits intomainfrom
ssr-esm-debugger
Jan 26, 2026
Merged

fix(SSR): ESM source map in VM#7052
chenjiahan merged 5 commits intomainfrom
ssr-esm-debugger

Conversation

@9aoy
Copy link
Contributor

@9aoy 9aoy commented Jan 26, 2026

Summary

fix esm ssr break point not working:

  • fix esm sourcemap in vm
  • fix debugger's NODE_OPTIONS environment variable being overridden
image

https://code.visualstudio.com/docs/nodejs/nodejs-debugging#_how-can-i-set-nodeoptions

Related Links

Checklist

  • Tests updated (or not required).
  • Documentation updated (or not required).

Copilot AI review requested due to automatic review settings January 26, 2026 07:45
@cloudflare-workers-and-pages
Copy link

cloudflare-workers-and-pages bot commented Jan 26, 2026

Deploying rsbuild with  Cloudflare Pages  Cloudflare Pages

Latest commit: 2ce027c
Status: ✅  Deploy successful!
Preview URL: https://9c892529.rsbuild-v2.pages.dev
Branch Preview URL: https://ssr-esm-debugger.rsbuild-v2.pages.dev

View logs

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR aims to fix SSR ESM breakpoint handling by improving how ESM modules are created in the VM and by avoiding overwriting any existing NODE_OPTIONS (e.g., those set by debuggers like VS Code).

Changes:

  • Adjust the EsmRunner to use the file path as the SourceTextModule identifier while keeping a custom URL query for sourcemap/breakpoint support.
  • Update e2e and SSR dev scripts to compose NODE_OPTIONS with --experimental-vm-modules (and --no-warnings for tests) instead of unconditionally overwriting it.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.

File Description
packages/core/src/server/runner/esm.ts Changes the VM SourceTextModule identifier and keeps a custom URL to improve ESM sourcemap and breakpoint behavior in SSR.
e2e/package.json Modifies the e2e Playwright test script to add VM-related flags via NODE_OPTIONS while attempting to respect any pre-existing debugger configuration.
e2e/cases/server/ssr/package.json Updates the SSR ESM dev script to set NODE_OPTIONS and TEST_ESM_LIBRARY in a way intended to preserve existing NODE_OPTIONS.
e2e/cases/server/ssr-type-module/package.json Updates the SSR type: module dev script to compose NODE_OPTIONS with --experimental-vm-modules without overwriting prior settings.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@chenjiahan chenjiahan changed the title fix(ssr): esm sourcemap in vm fix(ssr): ESM source map in VM Jan 26, 2026
@chenjiahan chenjiahan changed the title fix(ssr): ESM source map in VM fix(SSR): ESM source map in VM Jan 26, 2026
@chenjiahan chenjiahan merged commit c60b688 into main Jan 26, 2026
7 checks passed
@chenjiahan chenjiahan deleted the ssr-esm-debugger branch January 26, 2026 08:13
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.

2 participants