New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

requi-re

Package Overview
Dependencies
Maintainers
1
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

requi-re

Re-Require a module bypassing the cache when in a development environment (using NODE_ENV).

  • 1.1.17
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
4
decreased by-71.43%
Maintainers
1
Weekly downloads
 
Created
Source

requi-re Build Status

Re-Require a module bypassing the cache when not in a production environment.

Useful for development purposes when you need to freshly require a module after modifying it.

Install

$ npm install --save requi-re

Setup

By default, requi-re returns node's native require, in order to not fuck things up in bad setups.

Only when NODE_ENV is set to anything else than production (and is not undefined) all calls will return be fleshly required modules.

There are various ways of setting NODE_ENV on different operation systems. To avoid cross-plattform problems, the usage of the module cross-env is recommended.

Defining the environment using the package.json
  "scripts": {
    "start": "cross-env NODE_ENV=production node app",
    "development": "cross-env NODE_ENV=development node app"
  }

Then start your app using npm development to enable cache-deletion when calling requi-re.
Notice: npm start and any other scripts starting your app will continue to behave as usual.

Usage

// foo.js
let i = 0;
module.exports = () => ++i;
require('./foo')();
//=> 1

require('./foo')();
//=> 2

// overwrite node's require for convenience
require = require('requi-re');

require('./foo')();
//=> 1

require('./foo')();
//=> 1
  • cross-env - Recommended for defining NODE_ENV
  • require-uncached - Require a module bypassing the cache
  • clear-require - Clear a module from the require cache

License

requi-re is a fork of require-uncached: MIT © Sindre Sorhus

Keywords

FAQs

Package last updated on 15 Jan 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc