seek-oss / skuba

🤿 SEEK development toolkit for backend applications and packages
https://seek-oss.github.io/skuba/
MIT License
60 stars 33 forks source link

`skuba node` should work on .mts files in CJS projects #1733

Open AaronMoat opened 4 days ago

AaronMoat commented 4 days ago

As a stepping stone to ESM support, this should probably work:

pnpm skuba node <my-file.mts>
Error: Transform failed with 1 error:
repo/myfile.ts:3:0: ERROR: Top-level await is currently not supported with the "cjs" output format
    at failureErrorWithLog (repo/node_modules/tsx/node_modules/esbuild/lib/main.js:1476:15)
    at repo/node_modules/tsx/node_modules/esbuild/lib/main.js:755:50
    at responseCallbacks.<computed> (repo/node_modules/tsx/node_modules/esbuild/lib/main.js:622:9)
    at handleIncomingPacket (repo/node_modules/tsx/node_modules/esbuild/lib/main.js:677:12)

Meanwhile, running tsx directly is fine (for the same file)

AaronMoat commented 4 days ago

As far as I can tell this is because we're using the wrapper, added back in https://github.com/seek-oss/skuba/pull/341. Not sure the best way to tackle; can we effectively just call tsx {args}?