# cache-require-source

> Caches loaded source in module require to speed up next app load

Latest version **0.1.0** (published 2015-04-23) · MIT license · 0 weekly downloads

## Install

```sh
npm install cache-require-source
pnpm add cache-require-source
yarn add cache-require-source
bun add cache-require-source
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.0 |
| Published | 2015-04-23 |
| First published | 2015-04-23 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 3 |
| Author | Gleb Bahmutov |
| Maintainers | bahmutov |
| Keywords | npm, node, application, load, startup, performance, speed, cache, resolution |

## Links

- npm: https://www.npmjs.com/package/cache-require-source
- Repository: https://github.com/bahmutov/cache-require-source
- Issues: https://github.com/bahmutov/cache-require-source/issues
- npm.io page: https://npm.io/package/cache-require-source

## Alternatives

- [memory-cache](https://npm.io/package/memory-cache.md) — 795.0K weekly downloads
- [@httptoolkit/proxy-agent](https://npm.io/package/@httptoolkit/proxy-agent.md) — 11.2K weekly downloads
- [express-cache-controller](https://npm.io/package/express-cache-controller.md) — 5.3K weekly downloads
- [http-cache-middleware](https://npm.io/package/http-cache-middleware.md) — 4.5K weekly downloads
- [cache2](https://npm.io/package/cache2.md) — 1.5K weekly downloads

## Recent versions

- 0.1.0 (latest) — 2015-04-23

## README

# cache-require-source

> Caches loaded source in module require to speed up next app load

This is a partial solution to slow Node application startup. 
See [Node’s `require` is dog slow](https://kev.inburke.com/kevin/node-require-is-dog-slow/) for details.

## Use

    npm install --save cache-require-source

Load the module first in your application file

```js
// index.js
require('cache-require-source');
...
```

The first time the app loads a cache of 3rd party file sources will be saved in a local `.` file.
Every application startup after that will reuse this cache to avoid loading multiple files.
Works well with [cache-require-paths](https://github.com/bahmutov/cache-require-paths).

## TODO

- [ ] Cache only the 3rd party javascript sources
- [ ] Invalidate cache if dependencies in the package.json change

## Small print

Author: Gleb Bahmutov &copy; 2015

* [@bahmutov](https://twitter.com/bahmutov)
* [glebbahmutov.com](http://glebbahmutov.com)
* [blog](http://glebbahmutov.com/blog)

License: MIT - do anything with the code, but don't blame me if it does not work.

Spread the word: tweet, star on github, etc.

Support: if you find any problems with this module, email / tweet /
[open issue](https://github.com/bahmutov/cache-require-source/issues) on Github

---
_Source: https://npm.io/package/cache-require-source · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
