Fix asyncHook callback interceptor for ProfilingPlugin

While writing a custom profiler I ran into the issue that TerserPlugin never called it’s `end` trace. Eventually I tracked it down to the callback function. Instead of being overwritten it was being appended to the end of the function arguments. The callback has to be popped first because the added argument is a wrapper for the original callback.
This commit is contained in:
Tim Neutkens 2019-08-12 20:39:23 +02:00
parent ba56f7eee0
commit 069c33a033
1 changed files with 1 additions and 1 deletions

View File

@ -391,8 +391,8 @@ const makeNewProfiledTapFn = (hookName, tracer, { name, type, fn }) => {
id,
cat: defaultCategory
});
const callback = args.pop();
fn(...args, (...r) => {
const callback = args.pop();
tracer.trace.end({
name,
id,