source: imaps-frontend/node_modules/import-fresh/readme.md

main
Last change on this file was d565449, checked in by stefan toskovski <stefantoska84@…>, 4 weeks ago

Update repo after prototype presentation

  • Property mode set to 100644
File size: 1.4 KB
Line 
1# import-fresh
2
3> Import a module while bypassing the [cache](https://nodejs.org/api/modules.html#modules_caching)
4
5Useful for testing purposes when you need to freshly import a module.
6
7## Install
8
9```
10$ npm install import-fresh
11```
12
13## Usage
14
15```js
16// foo.js
17let i = 0;
18module.exports = () => ++i;
19```
20
21```js
22const importFresh = require('import-fresh');
23
24require('./foo')();
25//=> 1
26
27require('./foo')();
28//=> 2
29
30importFresh('./foo')();
31//=> 1
32
33importFresh('./foo')();
34//=> 1
35```
36
37## import-fresh for enterprise
38
39Available as part of the Tidelift Subscription.
40
41The maintainers of import-fresh and thousands of other packages are working with Tidelift to deliver commercial support and maintenance for the open source dependencies you use to build your applications. Save time, reduce risk, and improve code health, while paying the maintainers of the exact dependencies you use. [Learn more.](https://tidelift.com/subscription/pkg/npm-import-fresh?utm_source=npm-import-fresh&utm_medium=referral&utm_campaign=enterprise&utm_term=repo)
42
43## Related
44
45- [clear-module](https://github.com/sindresorhus/clear-module) - Clear a module from the import cache
46- [import-from](https://github.com/sindresorhus/import-from) - Import a module from a given path
47- [import-cwd](https://github.com/sindresorhus/import-cwd) - Import a module from the current working directory
48- [import-lazy](https://github.com/sindresorhus/import-lazy) - Import modules lazily
Note: See TracBrowser for help on using the repository browser.