jiti
2.7.0 · 5 May 2026MIT267.2M / weekRepositoryHomepagenpmAtom feed
101 stable releases, newest first, by release line. Notes are quoted as the maintainers published them.
- 2.x · latest line
2.7.0
5 May 2026Add explicit resource management (
using/await using) supportSupport opt-in
tsconfigPathsSupport virtual modules
Enhancements
Add explicit resource management (
using/await using) supportSupport opt-in
tsconfigPathsSupport virtual modules
Add
jiti/staticsubpath
Performance
interopDefault: Add caching to reduce proxy overhead by ~2x
Fixes
require: Passthrough resolve options
require: Fallback to transpilation when
tryNativefailsFallback for
ENAMETOOLONGwhen evaluating esm
2.6.1
1 Oct 2025interop: Only passthrough default if it is not a promise
2.6.0
22 Sep 2025Install size reduced from
2.03MBto1.67MBLoading times improved
150ms=>22ms(full transform:180ms=>115ms)Lazy load transformer
What is new?
This release fixes minor issues, migrates to Rspack for dist, and lazily imports the Babel transformer only when needed, which should noticeably improve startup times.
Install size reduced from
2.03MBto1.67MBLoading times improved
150ms=>22ms(full transform:180ms=>115ms)
Performance
Lazy load transformer
Fixes
cjs-interop: Handle function default exports
Always use native require/import for
node:specifiers
2.5.1
24 Jul 2025interop: Passthrough module if it is a promise
2.5.0
23 Jul 2025Summary· from the note as AI read it
Nothing to change: 2 new, 2 fixed.
Enhancements
Use
sha256for cache entries in FIPS modeSupport
rebuildFsCache(JITI_REBUILD_FS_CACHE)
Fixes
Interop modules with null/undefined default export
Handle
require(<json>)in register mode
2.4.2
17 Dec 2024cache: Add
+mapsuffix to fs entries whensourceMapsenabledUse native require cache of loaded entries only for Node.js 22.12.+ compatibility
compare changes (📦 bundled dependencies updated)
Fixes
cache: Add
+mapsuffix to fs entries whensourceMapsenabledUse native require cache of loaded entries only for Node.js 22.12.+ compatibility
2.4.1
29 Nov 2024Interop modules with primitive default export
2.4.0
1 Nov 2024Support generic type for
jiti.import<T>Try to resolve
.tsfiles with.jsextension from js files
Enhancements
Support generic type for
jiti.import<T>
Fixes
Try to resolve
.tsfiles with.jsextension from js files
2.3.3
7 Oct 2024eval: Return fallback value
2.3.2
7 Oct 2024eval: Fallback in async mode
2.3.1
5 Oct 2024Conditional access to
mod.default
2.3.0
5 Oct 2024Support
jiti.import(id, {default: true})interopDefault: Avoid
inoperator for primitive inputsinteropDefault: Simplify logic for default export checks
Important
To enhance compatibility, jiti
>=2.1enabledinteropdefaultusing a new Proxy method. If you migrated to2.0.0earlier, this might have caused behavior changes. In case of any issues during the upgrade, please report so we can investigate to solve them. 🙏🏼Enhancements
Support
jiti.import(id, {default: true})
Fixes
interopDefault: Avoid
inoperator for primitive inputsinteropDefault: Simplify logic for default export checks
2.2.1
4 Oct 2024Bump cache version
2.2.0
4 Oct 2024Use smarter proxy for
interopDefault
Important
To enhance compatibility, jiti
>=2.1enabledinteropdefaultusing a new Proxy method. If you migrated to2.0.0earlier, this might have caused behavior changes. In case of any issues during the upgrade, please report so we can investigate to solve them. 🙏🏼Enhancements
Use smarter proxy for
interopDefault
2.1.2
3 Oct 2024Use local
NodeModuletype
2.1.1
3 Oct 2024types: Add standalone types for node require
types: Add standalone types for node require
2.1.0
1 Oct 2024- Deprecated
Deprecate commonjs api
Enable
interopDefaultby defaultSupport
import.meta.dirnameandimport.meta.filename
Important
To enhance compatibility, jiti
>=2.1enabledinteropdefaultusing a new Proxy method. If you migrated to2.0.0earlier, this might have caused behavior changes. In case of any issues during the upgrade, please report so we can investigate to solve them. 🙏🏼Enhancements
Enable
interopDefaultby defaultSupport
import.meta.dirnameandimport.meta.filename
Performance
cli: Enable node 22 compile cache (%17 faster)
Fixes
Make
TransformOptionstype strict to allow auto-completeProperly handle tsx
Refactors
- Deprecated
Deprecate commonjs api
2.0.0
25 Sep 2024Summary· from the note as AI read it
Read before upgrading: 7 changes to make.
Highlights
Native ESM
jiti v2 now natively supports ESM import and resolution with new API
await jiti.import(id)andjiti.esmResolve(id). This allows top-levelawaitand native+faster importing of ES-only modules with increased compatibilityJSX Support
You can now directly import
.jsx/.tsxfiles with jiti! See examples with nano-js, preact, React and Vue. This feature is opt-in for now (usingjsx: trueorJITI_JSX=true). Jiti is considering a smarter lib detection for wider support before enabling JSX support by default.Dual format package exports
jitipackage exports are now in a dual (ESM/CJS) format for better importing of jiti in ESM contexts.jiti/nativeAs native ESM and Typescript support is being increased across runtimes, a new export in jiti allows easing up the transition by giving the same API of jiti but instead only depending on runtime
import.meta.resolveand dynamicimport()support. This is possible by making an alias forjititojiti/native.ESM Loader
You can globally register jiti using Node.js global hooks (experimental).
CLI:
# Instead of `npx jiti index.ts` node --import jiti/register index.ts
Programmatic:
import "jiti/register"; // or await import("jiti/register");Better inspection
You can inspect what jiti internals using
debugoption orJITI_DEBUG=1environment variable. The output is now more readable and with colors to easily find slow imports.jiti will also use
node_modules/.cache/jitidirectory instead of temp dir (ifnode_modulesexists) to store caches for easier local inspections.Migration
Upgrade
jitidependency to^2.0.0inpackage.jsonUse new
createJitinamed export :ESM:
--- import createJiti from "jiti" +++ import { createJiti } from "jiti" const jiti = createJiti(import.meta.url)CommonJS:
--- const createJiti = require("jiti") +++ const { createJiti } = require("jiti") const jiti = createJiti(__filename)Migrate from CommonJS to ESM API: (highly recommended!)
Importing modules:
--- const mood = jiti('mod') +++ const mood = await jiti.import('mod')Resolving modules:
--- const path = jiti.resolve('mod') +++ const path = jiti.esmResolve('mod')Changes since v1
Enhancements
top-level
awaitsupportNative ESM support
Add experimental ESM loader support
Allow try and other resolve options for
jiti.esmResolveAllow configure
interopDefaultusingJITI_INTEROP_DEFAULTenvjiti/nativesubpathHandle
data:importsSupport opt-in JSX
Eval ESM modules with fallback loader
Support
import.meta.resolve
Performance
Reduce overhead of jiti sub-instances
Use native
createRequire
Fixes
Use distinct cache paths for async mode
Resolve with ESM conditions in async context
cache: Prefer
node_modules/.cacheif existsUse native ESM import for built-ins
Respect
interopDefaultin babel transformSplit cache based on
interopDefaultRemove extention from cache path
Properly resolve
.mts/.ctswith.mjs/.cjsimportsresolve: Make sure
parentURLis a dirHandle global
URLinstance mismatchOptional access to
Reflect.metadatafor typescript decoratorsOnly pass
pathsoption to nativerequire.resolve
- 1.x
1.21.7
17 Dec 2024Use native require cache of loaded entries only Node.js 22.12.+ compatibility
compare changes (📦 bundled dependencies updated)
Fixes
Use native require cache of loaded entries only Node.js 22.12.+ compatibility
1.21.6
10 Jun 2024Use internal cached modules only if loaded
1.21.4
10 Jun 20241.21.3
5 Jun 2024Update to mlly@v1.7.1 (9adbcb3) (context)
1.21.1
5 Jun 2024🌷 This release updates bundled non-major dependencies (compare changes)
1.20.0
7 Sep 2023Experimental native Bun support
1.19.3
18 Aug 2023Only replace
import.meta.env
1.19.2
18 Aug 2023Pass custom extensions to esm resolver
Support
import.meta.envandimport.meta.env?.prop
Fixes
Pass custom extensions to esm resolver
Support
import.meta.envandimport.meta.env?.prop
1.19.0
4 Jul 2023Expose
jiti.evalModuleHandle nested circular dependencies
types: Export
JITIOptionsandTreansformOptions
Enhancements
Expose
jiti.evalModule
Fixes
Handle nested circular dependencies
types: Export
JITIOptionsandTreansformOptions
1.18.2
15 Mar 2023Allow resolving
.tsfiles with.jsextensionSupport
import.meta.envUse extension resolutions only for parent typescript files
Enhancements
Allow resolving
.tsfiles with.jsextensionSupport
import.meta.env
Performance
Use extension resolutions only for parent typescript files
Fixes
Handle parents with
.cts/.mtsextension too
1.17.2
6 Mar 2023Add support to emit decorator metadata
Use inline require cache to avoid circular dependencies
Workaround for pnpm and
TMPDIR
Fixes
Add support to emit decorator metadata
Use inline require cache to avoid circular dependencies
Workaround for pnpm and
TMPDIR
Styles
Format with prettier
1.17.1
17 Feb 2023Prefer
requirecondition first in esm resolve mode
1.17.0
8 Feb 2023Add support for
.mtsSupport import assertions and
.jsonimports with.defaultproperty
1.14.0
20 Jun 2022Detect native esm using
type: moduleUse inlined import meta plugin to inject url
1.13.0
18 Feb 2022Support inline sourceMaps for easier debugging
Use backslash to make import maps working in windows
A whole project to check? Paste its package.json in the dependency check: every deprecated, outdated or vulnerable dependency, with what to upgrade to. Free, no account.