Let's give the people async/await by default (and the other es2017 goodies).
Done in af320768eb5dfe8
Cool 馃槃
Async/await is not working for me in version 1.2 without installing and loading babel-polyfill
Should I create a new issue or do you want to reopen this one?
@flybayer What version of node you got?
Node 7.10.0
thanks, and you got .babelrc with env preset?
I should have added the error I get in the Browser console without babel-polyfill:
Uncaught ReferenceError: regeneratorRuntime is not defined
My .babelrc:
{
"presets": [
["env", {"modules": false}]
],
"plugins": [
"transform-object-rest-spread",
],
}
You would need to use this option - https://github.com/babel/babel-preset-env#usebuiltins-boolean
See this issue - https://github.com/babel/babel-preset-env/issues/92
I guess something like this would work, please give it a go -
"presets": [
[
"env",
{
"targets": {
"node": "current"
},
"useBuiltIns": true
}
]
]
We should probably update .babelrc
{
"presets": [
["env", {
"modules": false,
"targets": {
"node": "current"
},
"useBuiltIns": true
}]
]
}
This works perfect!! (without babel-polyfill). Thank you @gauravtiwari !!
{
"presets": [
["env", {
"modules": false,
"targets": {
"node": "current"
},
"useBuiltIns": true
}]
]
}
So this changed worked fine until I tried to run in production mode which results in uglify failing because of ES6/7 syntax (see #306).
I'm now back to using babel-polyfill and:
{
"presets": [
["env", {
"modules": false,
"targets": {
"node": "current",
"uglify": true
},
"useBuiltIns": true
}]
]
}
Lets document this in README @flybayer as this depends on the use case
in webpacker (3.2.0)
Add the babel plugin transform-runtime
npm install babel-plugin-transform-runtime
{
"presets": [
[
"env",
{
"modules": false,
"targets": {
"browsers": "> 1%",
"uglify": true
},
"useBuiltIns": true
}
]
],
"plugins": [
"syntax-dynamic-import",
"transform-object-rest-spread",
"transform-runtime",
[
"transform-class-properties",
{
"spec": true
}
]
]
}
Thanks @MiguelSavignano. This solved the Uncaught ReferenceError: regeneratorRuntime is not defined issue for me too.
Most helpful comment
in webpacker (3.2.0)
Add the babel plugin transform-runtime
npm install babel-plugin-transform-runtime