Package Exports
- clear-module
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (clear-module) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
clear-module 
Clear a module from the cache
Useful for testing purposes when you need to freshly import a module.
Install
$ npm install clear-module
Usage
// foo.js
let i = 0;
module.exports = () => ++i;
const clearModule = require('clear-module');
require('./foo')();
//=> 1
require('./foo')();
//=> 2
clearModule('./foo');
require('./foo')();
//=> 1
API
clearModule(moduleId)
moduleId
Type: string
What you would use with require()
.
clearModule.all()
Clear all modules from the cache.
clearModule.match(regex)
Clear all matching modules from the cache.
regex
Type: RegExp
Regex to match against the module IDs.
Related
- import-fresh - Import a module while bypassing the cache
- import-from - Import a module from a given path
- import-cwd - Import a module from the current working directory
- import-lazy - Import a module lazily
License
MIT © Sindre Sorhus