Skip to content

Fix source path duplication in NLS plugin source maps and add corresponding test#300487

Merged
jrieken merged 1 commit intomainfrom
joh/conventional-emu
Mar 10, 2026
Merged

Fix source path duplication in NLS plugin source maps and add corresponding test#300487
jrieken merged 1 commit intomainfrom
joh/conventional-emu

Conversation

@jrieken
Copy link
Member

@jrieken jrieken commented Mar 10, 2026

No description provided.

Copilot AI review requested due to automatic review settings March 10, 2026 17:04
@jrieken jrieken enabled auto-merge (squash) March 10, 2026 17:04
@jrieken jrieken self-assigned this Mar 10, 2026
@vs-code-engineering vs-code-engineering bot added this to the 1.112.0 milestone Mar 10, 2026
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 fixes a bug in the NLS esbuild plugin where source map paths for files in nested directories were incorrectly duplicated (e.g., nested/deep/nested/deep/file.ts instead of nested/deep/file.ts). The issue occurred because the inline source map generated by the NLS plugin used the full repo-relative path as the source name, which esbuild then resolved relative to the file's own directory, causing the directory segments to appear twice in the final bundled source map.

Changes:

  • Changed sourceName in the NLS plugin from the full relative path to just path.basename(args.path), preventing esbuild from double-resolving directory segments.
  • Added a regression test that bundles a file in a nested directory (nested/deep/file.ts) and verifies the source map path is not duplicated.

Reviewed changes

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

File Description
build/next/nls-plugin.ts Changed sourceName from repo-relative path to path.basename(args.path) to fix source map path duplication
build/next/test/nls-sourcemap.test.ts Added regression test verifying nested file source paths are not duplicated in the source map

@jrieken jrieken merged commit cb61e0d into main Mar 10, 2026
47 of 49 checks passed
@jrieken jrieken deleted the joh/conventional-emu branch March 10, 2026 17:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants