1.0.0 • Published 4 years ago

invalidate-require-cache v1.0.0

Weekly downloads
98
License
MIT
Repository
github
Last release
4 years ago

invalidate-require-cache

CircleCI Coverage Status semantic-release Commitizen friendly npm version

Delete modules in a folder from require.cache unless the folder is unchanged since last call.

This is used by jscodeshift-choose-parser to ensure that it always uses the current version of babel installed in a project.

const invalidateRequireCache = require('invalidate-require-cache')

invalidateRequireCache('path/to/directory')
// now everything inside that directory has been deleted from require.cache
// (unless it is unchanged since the last call)
// and will be reloaded if you require it again.