Neoclassical Philosophic Musings

    import-fresh
    TypeScript icon, indicating that this package has built-in type declarations

    3.0.0 • Public • Published

    import-fresh Build Status

    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

    Related

    License

    MIT © Sindre Sorhus

    Install

    npm i import-fresh@3.0.0

    Version

    3.0.0

    License

    MIT

    Unpacked Size

    3.66 kB

    Total Files

    4

    Last publish

    Collaborators

    • sindresorhus