5 ms·
We really need it to support top level await, and the author doesn't seem to be that interested in supporting it at the moment. Hopefully he will come around s
by duderific 6y ago
We really need it to support top level await, and the author doesn't seem to be that interested in supporting it at the moment. Hopefully he will come around soon.
- dbbk 6y agoInteresting, what is your use case for that?
- thitcanh 6y agoThe use case is that it exists: It’s already been vetted and it’s part of the language. Not supporting it means you don’t support the entire language.
- sknowieowl 6y agoIt's part of the language, but not so much thoroughly vetted. The Chrome/V8 implementation has bugs. https://github.com/evanw/esbuild/issues/253#issuecomment-773785579 https://github.com/evanw/esbuild/issues/253#issuecomment-773...
- thitcanh 6y agoI mean the feature itself has been vetted, i.e. it wouldn’t be in the language if enough people didn’t find it reasonably useful. TLA is a substantial feature implementation-wise so I expect TC39 to have thought “yeah that’s still worth it”
- sknowieowl 6y agoTLA was accepted in the specification before the module loading scenarios were fully baked. Probably best to use async IIFEs until the TLA spec bugs are sorted out and the fixes are subsequently implemented in the major browsers and released. Maybe a year from now.
- ratww 6y agoThe use case is not needing to wrap your code in an IIFE [1] when you would have a top-level await statement. It is useful in entry point of apps where you might need anything that uses async. It's also useful for having async modules. [2] They're also very helpful for debugging. Using await something in the console is way more convenient than something.then(). [1] https://developer.mozilla.org/en-US/docs/Glossary/IIFE https://developer.mozilla.org/en-US/docs/Glossary/IIFE [2] https://github.com/tc39/proposal-top-level-await/blob/HEAD/README.md https://github.com/tc39/proposal-top-level-await/blob/HEAD/R...
- constexpr 6y agoI'm the author of esbuild. Rest assured that I am very interested in supporting it and am actively working on it. It's just unfortunately very complicated to correctly, especially without affecting any of the other existing features. There are some recent updates at the bottom of this thread: https://github.com/evanw/esbuild/issues/253 https://github.com/evanw/esbuild/issues/253.