-
Notifications
You must be signed in to change notification settings - Fork 23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use require.resolve when deleting key in require.cache #520
Comments
Nevermind, a working solution is far more complicated. I solve it by implementing a own cache. |
Awesome. Was it easy? I focused on having the API easy to inherit and extend so let me know if something was more difficult than needed to create your own filesystem cache. |
I reopened the issue. I think that using require.resolve may be a better approach anyway. Not sure I can find a test to demonstrate this though. I keep the issue opened to not forget giving it a try. |
Since ncc uses webpack under the hood you can use the native node require function with
|
I would suggest to replace the following line:
twing/src/lib/cache/filesystem.ts
Line 47 in 56e186b
With this:
delete cache[require.resolve(modulePath)];
Why is this necessary? Packages like https://github.com/vercel/ncc use their own
require.cache
implementation. This small fix ensures twing's cache to work as expected when bundled with ncc.The text was updated successfully, but these errors were encountered: