Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

invalidate-require-cache

codemodsquad33MIT1.0.0

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

require, hot-reloading

readme

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.