scarfS
Deno11mo ago
scarf

workaround for ts-node in package.json script

  1. many existing projects use package.json script with ts-node.
  2. due to https://github.com/denoland/deno/issues/17176 deno can't run them.
    "compile:typebox": "ts-node cases/typebox/index.ts cases/typebox/build",

    have anyone found workaround to run this?
    i've considered
    ```sh
    // replace ts-node with run.sh in scripts
    #!/bin/sh
case $JS_RUNNER in
"deno") deno run -A $@ ;;
"bun" ) bunx $@ ;;
  • ) npx ts-node $@ ;;
    esac
    ```
    but it complicates everything.
related: https://github.com/denoland/deno/issues/27166

this is esp. problematic as existing node project still needs
ts-node
. if only there were a way to shim
ts-node
to
deno
...
GitHub
deno run -A npm:ts-node error: Uncaught Error: Empty filepath. at pathDirname (deno:ext/node/02_require.js:50:13) at new Module (deno:ext/node/02_require.js:255:17) at Function.Module._resolveFilen...
GitHub
Version: Deno 2.1.2 This is the same error as #20625, but not in the same context. Trying to create an alias for npx tsx --test (to test codebase on node js) but for some reason when executed throu...
Was this page helpful?