Skip to content

Commit 069c33a

Browse files
committed
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.
1 parent ba56f7e commit 069c33a

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/debug/ProfilingPlugin.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -391,8 +391,8 @@ const makeNewProfiledTapFn = (hookName, tracer, { name, type, fn }) => {
391391
id,
392392
cat: defaultCategory
393393
});
394+
const callback = args.pop();
394395
fn(...args, (...r) => {
395-
const callback = args.pop();
396396
tracer.trace.end({
397397
name,
398398
id,

0 commit comments

Comments
 (0)