-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Closed
Description
The core-js polyfill implementation of queueMicroTask() always falls back on process.nextTick() in Node, which schedules execution ahead of promise resolve/reject microtasks. This is not the behavior that you get with Node's native queueMicroTask() function.
Consider the following:
Promise.resolve().then(() => {
console.log("first");
})
queueMicrotask(() => {
console.log("second");
})
Using the core-js polyfill you get "second/first", but using the Node 11+ native function you get "first/second".
This could be resolved using Promise.resolve().then(...)
instead of process.nextTick(...)
. I realize there would be a performance penalty, but the alternative is running code in an unpredictable order, which can outright break things.
Metadata
Metadata
Assignees
Labels
No labels