-
Notifications
You must be signed in to change notification settings - Fork 891
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
Support async/await #142
Comments
Oh, another problem is that
|
Your change to But since Uglify can't deal with anything beyond ES5, minification breaks. |
Oh, so why did I need to change babel for it not to complain? Any ideas how to keep the bundle size low but using features like await? |
Probably because transpiling async requires a polyfill, not just transpilation. And you didn't provide said polyfill. After you told babel not to transpile, it had no problem. |
What about minimising the bundle since async/await isn't liked by UglifyJS? |
you can switch to babel-minify-webpack-plugin. However, I don't think we will switch this template to support all of this, load polyfills etc. - it's meant to be a simple, basic template. |
But, if you use uglifyJS as you do for creating the production bundle, and someone uses async/await, it won't simply work? |
No. If they don't transpile and polyfill aync /await, then ES6/7 code will be passed to Uglify, which it can't handle. If you properly setup babel to transpile to Es5 and also polyfill missing features for this transpilation (namely generators), then Uglify only receives ES5 code and is happy. |
Still struggling to understand why there is a need to transpile by default with leading browsers such as Safari & Chrome support this stuff? And surely you can't expect people using this project to know how to easily use polyfill? |
Well, that choice is not that easy. This template aims to work on all browsers that Vue supports, which includes IE11 (or even 9). This requires transpilation to ES5. So we would have to include a polyfill by default for generators to make transpilation to ES5 possible for async/await- and that polyfill is quite heavy. So we either
If we choose option 2, we should ...
So this can be done and considered, but is not as easy as the babel config you showed. |
Option 2 and 2 gets my vote. |
why bother |
The following code doesn't work unless babel is massaged.
Easiest way to support it, appears to be updating .babelrc
The text was updated successfully, but these errors were encountered: