Async/Await in Build Output?
See original GitHub issueHello again, @surma đ
So I was having some funny build errors (Not working with closure compiler, and Webpack was sad). Then, I looked through the unpkg and found a bunch of non-ES5 friendly code đ¤
Is this by design? Usually bundlers will ignore anything in the node_modules
, and I noticed in later versions things were transpiled down?
P.S itâs the end of the day for me, so I may just be done for the day đ
Issue Analytics
- State:
- Created 4 years ago
- Reactions:2
- Comments:10 (1 by maintainers)
Top Results From Across the Web
How do I call async property in Widget build method
Just move the code you tried to execute to another function and call it from initState . There is no need to await...
Read more >How to Build Widgets with an Async Method Call - Flutter Igniter
Not possible! A widget's build âsyncâ method will NOT wait for you while you fetch data. (You might even get a type 'Future'...
Read more >async function - JavaScript - MDN Web Docs - Mozilla
Async functions can contain zero or more await expressions. Await expressions make promise-returning functions behave as though they're ...
Read more >Asynchronous programming: futures, async, await | Dart
The async and await keywords provide a declarative way to define asynchronous functions and use their results. Remember these two basic guidelines when...
Read more >How to Implement JavaScript Async/Await? - Simplilearn
Here, we will talk about one of its key featuresâJavaScript async/await, which are asynchronous programming constructs. Async and await build on ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
(TIL
unpkg.com/browse
, thanks for that!)Yeah, I am following @justinfagnaniâs guidance here. I publish untranspiled modules to npm. The reason for this is that publishing ES5 to npm has stifled our ecosystemâs ability to move forward. The fact that some bundlers will not transpile
node_modules
is actually the problem here. I am not sure if Webpack can be configured to behave otherwise.FWIW, in my own projects I use TypeScript for transpilation and at that point you can just import the original TypeScript source file with an import:
That all being said: Is this just about async/await? If so, I only use it in one place and itâs probably fairly easy to rewrite that into a Promise chain.
I will look into removing async/await from the code as it is only used in one function and probably easily avoided. But I wonât guarantee it. That being said:
This is a bug in Webpack. TypeScript has always worked this way in that it will automatically prefer a
.ts
file for a.js
import. If Webpack does not behave this way, Webpack is breaking compatibility and convention here.I am already making use of these fields. Neither
main
normodule
imply transpilation to ES5, tho. Both CommonJS as well as ESM can contain async/await. As I stated above, the fact that some people expect ES5 to get published to npm has stifled our ecosystemâs ability to adopt modern JavaScript. Build tools like Webpack and Babel need to provide options to transpile dependencies. For Babel, for example, itâs just a matter of adjusting theexclude
config option, I think.Please do.