![]() | Name | Last modified | Size | Description |
---|---|---|---|---|
![]() | Parent Directory | - | ||
![]() | bin/ | a year ago | - | |
![]() | dist/ | a year ago | - | |
![]() | lib/ | a year ago | - | |
![]() | LICENSE | a year ago | 1.1K | |
![]() | README.md | a year ago | 3.8K | 595aea1 more query options + view options [كارل مبارك] |
![]() | package.json | a year ago | 2.8K | afd0ccc remove unused [كارل مبارك] |
![]() | register.js | a year ago | 47 |
Runtime Typescript and ESM support for Node.js.
[!IMPORTANT] This is the support branch for jiti v1. Check out jiti/main for the latest version and unjs/jiti#174 for the roadmap.
require
const 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();
debug
false
JITI_DEBUG
Enable debug to see which files are transpiled
cache
true
JITI_CACHE
Use transpile cache
If set to true
will use node_modules/.cache/jiti
(if exists) or {TMP_DIR}/node-jiti
esmResolve
false
JITI_ESM_RESOLVE
Using esm resolution algorithm to support import
condition.
transform
Transform function. See src/babel for more details
sourceMaps
false
JITI_SOURCE_MAPS
Add inline source map to transformed source for better debugging.
interopDefault
false
Return the .default
export of a module at the top-level.
alias
JITI_ALIAS
Custom alias map used to resolve ids.
nativeModules
JITI_NATIVE_MODULES
List of modules (within node_modules
) to always use native require for them.
transformModules
JITI_TRANSFORM_MODULES
List of modules (within node_modules
) to transform them regardless of syntax.
experimentalBun
process.versions.bun
exists (Bun runtime)JITI_EXPERIMENTAL_BUN
Enable experimental native Bun support for transformations.
corepack enable
pnpm install
pnpm dev
pnpm jiti ./test/path/to/file.ts
MIT. Made with 💖