Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

require-uncached

sindresorhus3mMITdeprecated2.0.0

Renamed to import-fresh.

Require a module bypassing the cache

require, cache, uncache, uncached, module, fresh, bypass

readme

require-uncached Build Status

Require a module bypassing the cache

Useful for testing purposes when you need to freshly require a module.

Install

$ npm install --save require-uncached

Usage

// foo.js
let i = 0;
module.exports = () => ++i;
const requireUncached = require('require-uncached');

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

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

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

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

License

MIT © Sindre Sorhus