Skip to content

fix(nodejs): add .js extension to vscode-jsonrpc/node import in session.ts#734

Closed
or2ooo wants to merge 1 commit intogithub:mainfrom
or2ooo:fix/session-vscode-jsonrpc-esm-import
Closed

fix(nodejs): add .js extension to vscode-jsonrpc/node import in session.ts#734
or2ooo wants to merge 1 commit intogithub:mainfrom
or2ooo:fix/session-vscode-jsonrpc-esm-import

Conversation

@or2ooo
Copy link

@or2ooo or2ooo commented Mar 9, 2026

Summary

Problem

SDK 0.1.31 added a new import to session.ts:

import { ConnectionError, ResponseError } from "vscode-jsonrpc/node";

Since the SDK declares "type": "module" (ESM) and vscode-jsonrpc@8.2.1 has no exports map, Node.js ESM resolution cannot resolve the bare subpath without the .js extension.

Error:

ERR_MODULE_NOT_FOUND: Cannot find module 'vscode-jsonrpc/node' imported from @github/copilot-sdk/dist/session.js

Fix

-import type { MessageConnection } from "vscode-jsonrpc/node";
-import { ConnectionError, ResponseError } from "vscode-jsonrpc/node";
+import type { MessageConnection } from "vscode-jsonrpc/node.js";
+import { ConnectionError, ResponseError } from "vscode-jsonrpc/node.js";

Fixes #707

@or2ooo or2ooo requested a review from a team as a code owner March 9, 2026 09:45
Copilot AI review requested due to automatic review settings March 9, 2026 09:45
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

Fixes a Node.js ESM runtime resolution failure in the Node SDK by aligning session.ts with the existing client.ts import pattern for vscode-jsonrpc.

Changes:

  • Update vscode-jsonrpc subpath imports in nodejs/src/session.ts to include the .js extension for ESM compatibility.

…on.ts

session.ts imports vscode-jsonrpc/node without the .js file extension.
Since the SDK uses ESM (type: module) and vscode-jsonrpc@8.2.1 has no
exports map, Node.js cannot resolve the extensionless subpath.

client.ts already uses the correct 'vscode-jsonrpc/node.js' form.
This is the same class of fix as github#8.

Fixes github#707
@or2ooo or2ooo force-pushed the fix/session-vscode-jsonrpc-esm-import branch from 790e733 to 5f78d8c Compare March 9, 2026 09:54
@SteveSandersonMS
Copy link
Contributor

Thanks for the contribution. This issue was already fixed by another commit, so I'll close it.

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.

ERR_MODULE_NOT_FOUND in 0.1.31: session.js missing .js extension on vscode-jsonrpc/node import

3 participants