-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
transforming for await loop not supported for browser that supports it #1930
Comments
The reason is that it's a very obscure feature that almost no one uses and it's non-trivial to implement. I think you're the first person to ask about it. In all my time writing JavaScript professionally I've seen exactly one use of
My source for browser compatibility data says that they are supported in Safari 12+. I just checked Safari 11.1 on BrowserStack and The simplest workaround for you is probably to just use a |
Yeah, I definitely agree that the code that uses it could(/should) be refactored to not use a for-await loop, but unfortunately the code is not directly under our maintenance. Interesting that both caniuse and mdn are off on this one, thanks for confirming that indeed safari11 does not support for await loops. Thanks for the detailed and swift answer 🙂 I'll close this issue then |
@evanw would you consider adding an option to let these pass through uncompiled? Then at least the rest of the code could be compiled to a certain target or browser. |
Why would you want to do that? Then the code still wouldn't work in the target browser. You could run another tool (e.g. Babel/TypeScript/SWC) after esbuild to post-process the code for the target browser, but then why not have that other tool transform other syntax too? If you want to use esbuild transform away the newest syntax that your other tools don't yet support, you can still use |
I noticed esbuild doesnt transform
for-await loops
for build targetsafari11
:However, according to both caniuse and mdn, safari11 does support
for-await
loops.It made me wonder if there is a particular reason esbuild doesnt currently handle it that I might be unaware of, or is this an oversight?
Reproduction:
https://stackblitz.com/edit/node-3gwvxg?file=index.js
The text was updated successfully, but these errors were encountered: