Add ability to whitelist/blacklist modules that should (not) be decached
- Dominant language
- JavaScript
- Stars
- 153
- Forks
- 12
- PR merge metrics
- No merged PRs in 30d
Description
This is somewhat related to #29 but a more specific feature request so filing it separately.
I'm running into some issues with `decache` uncaching instances of `react` and `react-dom`, so I'm getting errors like:
>Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:
>
>You might have mismatching versions of React and the renderer (such as React DOM)
I'm really guessing here, but it seems that deleting and re-requiring `react` causes some identity change for the library and... just ruins everything :)
This is most probably a very specific issue related to my dev environment, but I can pretty safely say that I do not need to uncache these modules (nor some other third party dependencies) since I'm not actively working on them.
Proposed syntax:
```
decache('./path/to/module', {
// specify only which modules should be uncached,
// child odules not matching these regex patterns should NOT be uncahced
whitelist: [
/node_modules\/react/,
/node_modules\/react-dom/
],
// specify which modules should NOT be uncached,
// all other child modules should be uncached
blacklist: [
/node_modules\/react/,
/node_modules\/react-dom/
]
});
```
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.