chore: switch to module ESNext + moduleResolution bundler (#2095)

This commit is contained in:
Matt 2026-06-25 12:49:17 +02:00 • committed by GitHub
commit ee732d64b6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 668 additions and 863 deletions

View file

@ -88,10 +88,10 @@ Create a `tsconfig.json` in the root of your project:
```json
{
"compilerOptions": {
"target": "ES2023",
"lib": ["ES2023"],
"module": "Node16",
"moduleResolution": "Node16",
"target": "ESNext",
"lib": ["ESNext"],
"module": "ESNext",
"moduleResolution": "bundler",
"outDir": "./build",
"rootDir": "./src",
"strict": true,
@ -236,7 +236,8 @@ Now let's add the core functionality for processing queries and handling tool ca
messages,
});
finalText.push(followUp.content[0].type === 'text' ? followUp.content[0].text : '');
const firstBlock = followUp.content[0];
finalText.push(firstBlock?.type === 'text' ? firstBlock.text : '');
}
}
@ -284,13 +285,14 @@ Finally, we'll add the main execution logic:
```ts source="../examples/client-quickstart/src/index.ts#main"
async function main() {
if (process.argv.length < 3) {
const serverScriptPath = process.argv[2];
if (!serverScriptPath) {
console.log('Usage: node build/index.js <path_to_server_script>');
return;
}
const mcpClient = new MCPClient();
try {
await mcpClient.connectToServer(process.argv[2]);
await mcpClient.connectToServer(serverScriptPath);
// Check if we have a valid API key to continue
const apiKey = process.env.ANTHROPIC_API_KEY;

View file

@ -103,9 +103,10 @@ Create a `tsconfig.json` in the root of your project:
```json
{
"compilerOptions": {
"target": "ES2022",
"module": "Node16",
"moduleResolution": "Node16",
"target": "ESNext",
"lib": ["ESNext"],
"module": "ESNext",
"moduleResolution": "bundler",
"outDir": "./build",
"rootDir": "./src",
"strict": true,