Sha256: 44001984d1ed4534eb82fa94eccad386aa7efd9c51cce7d9007eb066fcfdc3ff

Contents?: true

Size: 833 Bytes

Versions: 46

Compression:

Stored size: 833 Bytes

Contents

# require-uncached [![Build Status](https://travis-ci.org/sindresorhus/require-uncached.svg?branch=master)](https://travis-ci.org/sindresorhus/require-uncached)

> Require a module bypassing the [cache](https://nodejs.org/api/modules.html#modules_caching)

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


## Install

```
$ npm install --save require-uncached
```


## Usage

```js
// foo.js
let i = 0;
module.exports = () => ++i;
```

```js
const requireUncached = require('require-uncached');

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

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

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

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


## Related

- [clear-require](https://github.com/sindresorhus/clear-require) - Clear a module from the require cache


## License

MIT © [Sindre Sorhus](https://sindresorhus.com)

Version data entries

46 entries across 46 versions & 3 rubygems

Version Path
govuk_publishing_components-17.6.0 node_modules/require-uncached/readme.md
govuk_publishing_components-17.5.0 node_modules/require-uncached/readme.md
govuk_publishing_components-17.4.0 node_modules/require-uncached/readme.md
govuk_publishing_components-17.3.0 node_modules/require-uncached/readme.md
govuk_publishing_components-17.2.0 node_modules/require-uncached/readme.md
govuk_publishing_components-17.1.1 node_modules/require-uncached/readme.md
govuk_publishing_components-17.1.0 node_modules/require-uncached/readme.md
govuk_publishing_components-17.0.0 node_modules/require-uncached/readme.md
govuk_publishing_components-16.29.0 node_modules/require-uncached/readme.md
govuk_publishing_components-16.28.0 node_modules/require-uncached/readme.md
govuk_publishing_components-16.27.1 node_modules/require-uncached/readme.md
govuk_publishing_components-16.27.0 node_modules/require-uncached/readme.md
govuk_publishing_components-16.26.0 node_modules/require-uncached/readme.md
govuk_publishing_components-16.25.0 node_modules/require-uncached/readme.md
govuk_publishing_components-16.24.0 node_modules/require-uncached/readme.md
govuk_publishing_components-16.23.0 node_modules/require-uncached/readme.md
govuk_publishing_components-16.22.0 node_modules/require-uncached/readme.md
govuk_publishing_components-16.21.0 node_modules/require-uncached/readme.md
govuk_publishing_components-16.20.1 node_modules/require-uncached/readme.md
govuk_publishing_components-16.20.0 node_modules/require-uncached/readme.md