-
Notifications
You must be signed in to change notification settings - Fork 788
Closed
Labels
bugdocumentationImprovements or additions to documentationImprovements or additions to documentationsdk/nodejs
Description
Just tried following the TS tutorial, you get an error out of the box:
npx tsx index.ts
node:internal/modules/run_main:107
triggerUncaughtException(
^
Error: Transform failed with 3 errors:
/Users/sinedied/projects/_test/copilot-sdk/index.ts:4:16: ERROR: Top-level await is currently not supported with the "cjs" output format
/Users/sinedied/projects/_test/copilot-sdk/index.ts:6:17: ERROR: Top-level await is currently not supported with the "cjs" output format
/Users/sinedied/projects/_test/copilot-sdk/index.ts:9:0: ERROR: Top-level await is currently not supported with the "cjs" output format
at failureErrorWithLog (/Users/sinedied/projects/_test/copilot-sdk/node_modules/esbuild/lib/main.js:1467:15)
at /Users/sinedied/projects/_test/copilot-sdk/node_modules/esbuild/lib/main.js:736:50
at responseCallbacks.<computed> (/Users/sinedied/projects/_test/copilot-sdk/node_modules/esbuild/lib/main.js:603:9)
at handleIncomingPacket (/Users/sinedied/projects/_test/copilot-sdk/node_modules/esbuild/lib/main.js:658:12)
at Socket.readFromStdout (/Users/sinedied/projects/_test/copilot-sdk/node_modules/esbuild/lib/main.js:581:7)
at Socket.emit (node:events:508:28)
at addChunk (node:internal/streams/readable:559:12)
at readableAddChunkPushByteMode (node:internal/streams/readable:510:3)
at Readable.push (node:internal/streams/readable:390:5)
at Pipe.onStreamRead (node:internal/stream_base_commons:189:23) {
name: 'TransformError'
}
Node.js v24.13.0
you need to use npm init -y --init-type module to make it work. Sending PR
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugdocumentationImprovements or additions to documentationImprovements or additions to documentationsdk/nodejs