You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Consider the following snippet where we are breaking out of loop from inside a try block:
async function foo() {
while (true) {
try {
await null; // important
console.log(1);
break;
}
catch {}
console.log(2);
}
}
foo();
The second console.log should never run because we exit the while loop prior to that. But using babel-plugin-transform-async-to-promises and running the output of babel, it executes both console.log statements and then exits the loop:
$ ./node_modules/.bin/babel test.js | node
1
2
Contrast that to:
$ node test.js
1
The text was updated successfully, but these errors were encountered:
Consider the following snippet where we are breaking out of loop from inside a
try
block:The second
console.log
should never run because we exit thewhile
loop prior to that. But usingbabel-plugin-transform-async-to-promises
and running the output of babel, it executes bothconsole.log
statements and then exits the loop:Contrast that to:
The text was updated successfully, but these errors were encountered: