npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

active-require

v1.0.1

Published

Manage, load, and reload 'require'-based modules without restarting your application. Works both within scripts and on the command-line.

Downloads

5

Readme

ActiveRequire

Load and reload your Node.js modules whenever you wish, bypassing the require cache, and without having to restart your application.

Download via npm:
> npm install --save active-require

Basic usage for loading and reloading:

(Note: do not assign module variables you plan to reload using const, as attempts to reassign these values at a later time will produce an error)

//load the ActiveRequire module itself
const _require = require('active-require')
//load your target module using ActiveRequire
var myModule = _require('my-module')

//later, after having made changes to the module's files and/or dependencies, reload the module
myModule = _require('my-module')
//myModule will now contain your updated module's content

Or, use ActiveRequire's helper methods:

Load a single module and assign it to a namespace:
_require.set('myModule', 'my-module')

myModule;
//now returns the loaded module from the 'my-module' package
Or, load multiple modules at once:
//use keys to define each namespace and the each key's
//value to define the module to load for that namespace
_require.set({
  myModule : 'my-module',
  request : 'request',
  mongo : 'mongodb',
  _ : 'underscore'
})
// myModule, request, mongo, and _ are now all defined
// in the global scope and assigned their respective modules
Later, reload one of the modules:
_require.reset('myModule')
//updated module content will be loaded and assigned to myModule namespace

myModule;
//now returns updated module
Or, reload multiple modules:
_require.reset('myModule', 'mongo', '_')
//OR
let targetModules = ['myModule', 'mongo', '_']
_require.reset(targetModules)

//each module will be reloaded and the reloaded
//value will be assigned to the appropriate namespace

API

_require(module)

Load or reload a target module, using the same approach and format as the traditional require() method.

Arguments:

Argument | Description | Type | Required | Default --- | --- | --- | --- | --- module | The target module you wish to load (should match usual require() target module format). | String | Yes | n/a


_require.set(namespace, [module], [context])

Load a module and assign it to a specific namespace in the provided context's scope (default scope is global).

Arguments:

Argument | Description | Type | Required | Default --- | --- | --- | --- | --- namespace | If String:Defines the namespace to which the loaded module should be assigned.If Object:A set of key:value pairs, where each key defines the namespace to be used and each value defines the module to be loaded and assigned to the requisite namespace. | String/Object | Yes | n/a module | The module to be loaded and assigned to the namespace provided by the namespace argument. | String | No | null context | The context within which the module should be loaded and assigned. | Object | No | global


_require.reset(...namespaces)

Reload the modules assigned to each provided namespace (will only work for modules and namespaces previously loaded using the _require.set() method).

Arguments:

Argument | Description | Type | Required | Default --- | --- | --- | --- | --- namespaces | Either a single module namespace, multiple independent module namespaces, or an array of module namespaces that have been loaded using the _require.set() method previously, and that you would now like to have be reloaded and re-assigned to the namespace(s) provided. | String/Array | Yes | n/a


_require.useCommandLine()

Starts an repl session, allowing for modules to be loaded and reloaded via the command-line (using the _require.set() and _require.reset() methods) for any Node.js application being run in a terminal environment.


_require.map

Returns an object map containing information on the current namespaces defined via the _require.set() and _require.reset() methods and the module sources/values assigned to those namespaces.


**For any additional questions and/or comments, please contact: [email protected] **