node-source-map-support
node-source-map-support copied to clipboard
Export a removeFromCache(filepath) function
require('source-map-support').removeFromCache('path/to/foo.js') will remove path/to/foo.js from the source map cache.
Motivation
I use am using babel-register. At some point, my program notices that a file changes. So it calls
delete require.cache[require.resolve(filename)]
return require('filename');
Expected behavior
Stack traces show lines/columns from the updated file
Actual behavior
Stack traces still use the old source maps, so the locations are out of date
How this helps
After this lands, I can update babel-register to call removeFromCache(filename) whenever it transforms a file.
If #118 lands, then this will happen automatically, I believe.