Runtime typescript and ESM support for Node.js (CommonJS)
requireconst jiti = require('jiti')(__filename)
jiti('./path/to/file.ts')
You can also pass options as second argument:
const jiti = require('jiti')(__filename, { debug: true })
jiti index.ts
# or npx jiti index.ts
node -r jiti/register index.ts
Alternatively, you can register jiti as a require hook programmatically:
const jiti = require('jiti')()
const unregister = jiti.register()
debugfalseJITI_DEBUGEnable debug to see which files are transpiled
cachetrueJITI_CACHEUse transpile cache
If set to true will use node_modules/.cache/jiti (if exists) or {TMP_DIR}/node-jiti
transformTransform function. See src/babel for more details
yarnyarn buildyarn devyarn jiti ./test/path/to/file.tsMIT. Made with 💖
We use cookies
We use cookies to analyze traffic and improve your experience. You can accept or reject analytics cookies.