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
246 Stars 23 Forks MIT License 31 Commits 3 Opened issues

Description

Import a module while bypassing the cache

Services available

!
?

Need anything else?

Contributors list

# 221
exec
test-fr...
nextjs
messeng...
24 commits
# 46,494
chalk
exec
emitter
Vue.js
2 commits
# 17,927
React
Rust
Sass
Deno
1 commit
# 33,369
asteris...
exec
Babel
test-fr...
1 commit
# 222,388
React
Markdow...
selectb...
select-...
1 commit
# 73,300
Objecti...
Swift
messeng...
github-...
1 commit
# 15,698
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.