Skip to content

Migrate extension and tooling to native ESM - #9635

Closed
dibarbet wants to merge 1 commit into
mainfrom
dev/esm-migration
Closed

Migrate extension and tooling to native ESM#9635
dibarbet wants to merge 1 commit into
mainfrom
dev/esm-migration

Conversation

@dibarbet

@dibarbet dibarbet commented Aug 4, 2026

Copy link
Copy Markdown
Member

Summary

Move the C# extension, build tooling, Jest configuration, and integration entry points to native ESM now that VS Code supports ESM extension entry points.

  • declare the package as type: module and ship ./dist/extension.mjs
  • use TypeScript 5.7.3 with NodeNext/NodeNext, .ts source specifiers, rewriteRelativeImportExtensions, and normal tsc emission
  • emit test/jestProjectNames.mjs directly from tsc and keep module-relative ts-jest configuration resolution
  • select the ESM entry for @vscode/extension-telemetry 1.5.2
  • support .mjs across signing, debugging, packaging, and artifact validation
  • enforce structured development/production bundle audits

The bundle retains a narrowly scoped createRequire(import.meta.url) bridge because audited CommonJS dependencies still emit runtime requires. The audit currently locks this to 46 package owners, 279 modules, and 378 runtime requires; only the Razor component and vscode-languageclient require vscode at runtime.

This standalone PR supersedes #9630, #9631, #9632, and #9633, and replaces stack #9634.

Validation

  • npm run compileDev
  • direct tsc emission and source import audits
  • npm run test:unit
  • npm run omnisharptest:unit
  • npm run package and node --check dist/extension.mjs
  • explicit development and production bundle audits
  • npm run test:artifacts against a generated VSIX
  • VSIX manifest/content inspection
  • npm run test:integration:untrusted
  • npm run test:integration:csharp
  • git diff --check

Use package-native ESM and NodeNext TypeScript across the extension, tooling, Jest, and integration entry points, with normal tsc emission and a native .mjs extension bundle.

Retain only the audited createRequire bridge required by bundled CommonJS dependencies, select the telemetry ESM entry, and update signing, debugging, packaging, and artifact safeguards for .mjs output.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 720632a5-5bd9-43bb-9349-6c1a02fe3347
Copilot AI review requested due to automatic review settings August 4, 2026 23:38
@dibarbet
dibarbet requested review from a team as code owners August 4, 2026 23:38

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot wasn't able to review this pull request because it exceeds the maximum number of files (300). Try reducing the number of changed files and requesting a review from Copilot again.

@dibarbet

dibarbet commented Aug 5, 2026

Copy link
Copy Markdown
Member Author

Superseded by the two-PR stack #9637#9640.

@dibarbet dibarbet closed this Aug 5, 2026
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.

2 participants