Need help with import-fresh?
Click the “chat” button below for chat support from the developer who created it, or find similar developers for support.

About the developer

sindresorhus
224 Stars 23 Forks MIT License 31 Commits 2 Opened issues

Description

Import a module while bypassing the cache

Services available

!
?

Need anything else?

Contributors list

# 207
node
exec
test-fr...
nextjs
24 commits
# 46,489
Node.js
chalk
ESLint
exec
2 commits
# 15,770
React
Sass
Deno
GraphQL
1 commit
# 32,357
webfram...
exec
Babel
test-fr...
1 commit
# 224,573
React
Markdow...
selectb...
select-...
1 commit
# 74,434
Objecti...
Swift
messeng...
github-...
1 commit
# 14,264
video-r...
live-st...
c-plus-...
ffmpeg
1 commit

import-fresh

Import a module while bypassing the cache

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

Install

$ npm install import-fresh

Usage

// foo.js
let i = 0;
module.exports = () => ++i;
const importFresh = require('import-fresh');

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

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

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

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

import-fresh for enterprise

Available as part of the Tidelift Subscription.

The 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.

Related

We use cookies. If you continue to browse the site, you agree to the use of cookies. For more information on our use of cookies please see our Privacy Policy.