Decache removing all child dependencies of target module from cache #29
Labels
documentation
Improvements or additions to documentation
help wanted
If you can help make progress with this issue, please comment!
question
A question needs to be answered before progress can be made on this issue
T25m
Time Estimate 25 Minutes
Currently when a module with child dependencies is removed from the require cache via decache, all of its child dependencies are also removed from the cache.
For example:
When requiring a module that requires several other modules.
The require.cache will then contain references to each module.
e.g.
Object.keys(require.cache)
will look like:after calling decache on the
a.js
moduleThe require cache will no longer contain references to the a.js module specified or any of its dependencies
e.g.
Object.keys(require.cache)
will look like:This is due to the fact that the decache module recursively DFS the target modules dependency tree. Deleting each module passed by the callback iterator.
Is this behavior intended? Should the DFS instead be removing all references to child.parent? I would assume that some people using this module are depending on this behavior or have worked around it. Curious as to thoughts on this.
Thanks!
The text was updated successfully, but these errors were encountered: