Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
timneutkens committed Aug 12, 2019
1 parent ba56f7e commit 069c33a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/debug/ProfilingPlugin.js
Expand Up @@ -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,
Expand Down

0 comments on commit 069c33a

Please sign in to comment.