swc-jit

raw JSON →
0.2.0 verified Fri May 01 auth: no javascript maintenance

swc-jit v0.2.0 provides a just-in-time transpiler for Node.js using the experimental loader API, allowing TypeScript files to be executed directly without precompilation. It integrates with SWC for fast transpilation and supports source maps for debugging. The package is designed as a lighter alternative to ts-node, leveraging SWC's speed. However, it relies on Node's experimental loaders, which may change across Node versions. The package has no recent updates and may be considered in maintenance mode.

error Error [ERR_MODULE_NOT_FOUND]: Cannot find module 'swc-jit'
cause Package not installed or not in node_modules.
fix
Run npm install swc-jit in the project directory.
error TypeError [ERR_INVALID_ARG_TYPE]: The "url" argument must be of type string
cause Node version too old or incompatible loader hook.
fix
Use Node >=12.17.0 and ensure --experimental-loader is correctly specified.
breaking Node --experimental-loader flag is experimental and may change or be removed in future Node versions.
fix Use a stable alternative like ts-node or @swc-node/register for production.
deprecated Package has not been updated since 2021; may have compatibility issues with newer Node or SWC versions.
fix Consider using @swc-node/register or tsx as maintained alternatives.
gotcha Source maps require both --experimental-loader and --enable-source-maps flags.
fix Always pass both flags: node --experimental-loader swc-jit --enable-source-maps index.ts
npm install swc-jit
yarn add swc-jit
pnpm add swc-jit

Installs and runs a TypeScript file directly using Node's experimental loader with source maps.

npm install swc-jit
node --experimental-loader swc-jit --enable-source-maps index.ts