NewYour coding agent can read the release notes before it upgrades.Set up the MCP server →
npm · #1010 most downloaded on npm
Module to hook into the Node.js require function
Last release 11 months ago
20 Oct 2025
Release timing varies
gaps range from 1 weeks to 8 months
Some releases are documented
notes for 16 of 35 stable releases
Nothing withdrawn
no release was ever pulled
11 years old
35 releases · first in 2016
Bundler issue caused by require('./package.json')
One column per quarter.
Remove side effect to fix pnpm + vite issue
Runtime exception in Node SEA mode
version 7.5.0 (2025-01-27)
version 7.5.0 (2025-01-27)
require.resolve(), rather than require('resolve').sync(), when available.
This can be a performance improvement.
(https://github.com/nodejs/require-in-the-middle/pull/96)version 7.4.0 (2024-07-25)
version 7.4.0 (2024-07-25)
process.getBuiltinModule,
added in v22.3.0.
(https://github.com/nodejs/require-in-the-middle/pull/92)version 7.3.0 (2024-03-26)
version 7.3.0 (2024-03-26)
Hook will now match against package
entry points defined by "exports" in package.json.
https://nodejs.org/api/packages.html#package-entry-points
(https://github.com/nodejs/require-in-the-middle/pull/82)version 7.2.1 (2024-03-13)
version 7.2.1 (2024-03-13)
Hook can hook a module and a sub-module,
e.g. new Hook(['example', 'example/some-sub-module'], ...).
(https://github.com/nodejs/require-in-the-middle/pull/84)version 7.2.0 (2023-07-13)
version 7.2.0 (2023-07-13)
new Hook(null, onrequire), by caching exports
in more cases. Contributed by @nwalters512.
(https://github.com/nodejs/require-in-the-middle/issues/75)version 7.1.1 (2023-05-31)
version 7.1.1 (2023-05-31)
required
module does not appear in require.cache. This can only happen if there
is some other require hook in play -- e.g. @babel/register which is
used by @babel/cli, aka the babel-node command.
(https://github.com/nodejs/require-in-the-middle/issues/72)- Add TypeScript types.
Fix hooking of 'http2' with Node.js versions [8.0, 8.8) where the 'http2' built-in module was behind the --expose-http2 flag. (https://github.com/node
Fix hooking of 'http2' with Node.js versions [8.0, 8.8) where the 'http2'
built-in module was behind the --expose-http2 flag.
(https://github.com/nodejs/require-in-the-middle/pull/68)
Release v7.0.0 introduced a bug with this case where the process would crash with:
AssertionError [ERR_ASSERTION]: unexpected that there is no Module entry for "http2" in require.cache
at ExportsCache.set (.../require-in-the-middle4/index.js:72:7)
`js const Hook = require('require-in-the-middle'); // deprecated, still supported for backward compat `
Change the suggested require usage to be a Hook field on the exports,
const { Hook } = require('require-in-the-middle'); // the new suggested way
rather than the default export:
const Hook = require('require-in-the-middle'); // deprecated, still supported for backward compat
This is to avoid the need for users to use a default export which can get confusing or problematic with TypeScript. See https://github.com/open-telemetry/opentelemetry-js/issues/3701 for some details.
Change the suggested usage to new Hook(...) instead of Hook(...), but
both are supported.
Use the Node.js require.cache for caching the exports returned from a
Hook's onrequire. This allows users to delete entries from require.cache
to trigger a re-load (and re-run of the hook's onrequire) of a module the
next time it is required -- as mentioned at
https://nodejs.org/docs/latest/api/all.html#all_modules_requirecache
(https://github.com/nodejs/require-in-the-middle/issues/61)
(SEMVER-MAJOR) Remove the hook.cache field. In earlier versions this was
available and some tests used it. However it was never a documented field.
If resolving the filename for a require(...) fails, defer to the wrapped
require implementation rather than failing right away. This allows a
possibly-monkey-patched require to do its own special thing.
(https://github.com/nodejs/require-in-the-middle/pull/59)
Drop Node.js 6 support. New minimum supported Node.js version is 8.6.0. (This is the minimum supported Node.js version for elastic-apm-node@3 that use
master to main.Add support for hooking into the require of Node core modules prefixed with 'node:', e.g. require('node:http'). See https://nodejs.org/api/modules.htm
require('node:http'). See https://nodejs.org/api/modules.html#core-modules
(https://github.com/nodejs/require-in-the-middle/pull/53)Add support for hooking into require of absolute paths.
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Your coding agent can read these notes before it upgrades. Set up the MCP server →