Skip to content
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

Export a removeFromCache(filepath) function #149

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

gabelevi
Copy link

@gabelevi gabelevi commented Sep 8, 2016

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.

facebook-github-bot pushed a commit to facebook/flow that referenced this pull request Sep 30, 2016
Summary:
I have little faith that
evanw/node-source-map-support#149 will get merged any
time soon. That means we have to make do with out-of-date source maps when
tests change.

Luckily, record is the only command that really relies on the source maps. So
we can just spawn a new process and its source maps will be up to date! Hooray!

Reviewed By: samwgoldman

Differential Revision: D3949020

fbshipit-source-id: 10f34f58c76f14fb948c0a3d9265b4f9150ce393
@kpdecker
Copy link
Contributor

If #118 lands, then this will happen automatically, I believe.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants