I am unable to find any documentation on why the order of execution is nextTick queue followed by promise queue for CJS modules whereas promise queue followed by nextTick queue for ES modules. Any insight appreciated!
// index.js (CJS)
Promise.resolve().then(() => console.log("this is Promise.resolve 1"));
process.nextTick(() => console.log("this is process.nextTick 1"));
Logs "this is process.nextTick 1" and then "this is Promise.resolve 1"
// index.mjs (ESM)
Promise.resolve().then(() => console.log("this is Promise.resolve 1"));
process.nextTick(() => console.log("this is process.nextTick 1"));
Logs "this is Promise.resolve 1" and then "this is process.nextTick 1"