Skip to content

Expose emptyCache() function for nodejs+HMR support #266

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions source-map-support.js
Original file line number Diff line number Diff line change
Expand Up @@ -398,12 +398,16 @@ function wrapCallSite(frame, state) {
return frame;
}

function emptyCache() {
fileContentsCache = {};
sourceMapCache = {};
}

// This function is part of the V8 stack trace API, for more info see:
// https://v8.dev/docs/stack-trace-api
function prepareStackTrace(error, stack) {
if (emptyCacheBetweenOperations) {
fileContentsCache = {};
sourceMapCache = {};
emptyCache();
}

var name = error.name || 'Error';
Expand Down Expand Up @@ -585,3 +589,5 @@ exports.resetRetrieveHandlers = function() {
retrieveSourceMap = handlerExec(retrieveMapHandlers);
retrieveFile = handlerExec(retrieveFileHandlers);
}

exports.emptyCache = emptyCache;