ts-node icon indicating copy to clipboard operation
ts-node copied to clipboard

Invalidate source-map-support cache when `require.cache` is cleaned and file is re-required

Open cspotcode opened this issue 4 years ago • 0 comments

Invalidate source-map-support cache when require.cache is cleaned and file is re-required.

Fixes #268

Is emptyCacheBetweenOperations sufficient? Or will this cause unnecessary fs calls within source-map-support?

If we want to avoid a cache invalidation API in source-map-support, should we implement our own fs caching? It will call us because of empty cache every time, but we can implement caching and fs reads on our side.

Related to cspotcode/node-source-map-support#32

Maybe can use WeakMap to associate require.cache entry w/cached sourcemap. So that when require.cache is cleared, we automatically re-populate our own cache?

cspotcode avatar Oct 11 '21 03:10 cspotcode