babel-core 6.1.21
babel-loader 6.2.0
module: {
loaders: [{
test: /\.js$/,
exclude: /node_modules/,
loader: 'babel',
query: {
plugins: ['transform-runtime'],
presets: ['es2015', 'stage-0', 'stage-3']
}
}]
}
have an error:
Uncaught TypeError: (0 , _typeof3.default) is not a function
Seeing the same issue: https://travis-ci.org/ipfs/js-ipfs-api/jobs/92021174#L1703
Update Not using generators though, the code runs fine in node@4 so only features from there are used
@Dignifiedquire Thanks.
My Node.js version is 0.12.7. If I update to 4.x, can I use async/await in browser ? (I can use async/await in Node.js now, but can't use in browser. )
@wangxiao try this
it worked for me
@osomdevrepos I don't think that will work for running in a web browser - it looks like the code there is node.js.
There is the same issue in my application. How to solve it in browser? Thank you.
@liam4 @jtHwong hi guys, in order to use async/await functions with webpack and babel you need to add a babel polyfill in your entry on webpack config, this work on both, nodejs and browser, take a look:
entry: ['babel-polyfill', path_to_entry],
module: {
loaders: [
{
test: /\.js$/,
loader: 'babel',
query: {
presets: ['es2015', 'stage-0'],
plugins: ['transform-runtime']
}
},
]
}
this is how is working for me.
Thank you, @jesus-repos.
My config is the same as yours. But the problem was still.
I updated my packages by npm update . So all of my packages were newest. Can you show your package.json?
I try Babel5 and everything is ok.
thanks @jesus-repos, worked here!
Resolving as a resolution to the original issue exists
https://babeljs.io/docs/usage/polyfill/
OR
https://babeljs.io/docs/plugins/transform-regenerator/
.babelrc
{
"presets": ["env"]
}
webpack
require("babel-polyfill");
entry: ["babel-polyfill", "./src/backend-system/select-tree"],

Most helpful comment
@liam4 @jtHwong hi guys, in order to use async/await functions with webpack and babel you need to add a babel polyfill in your entry on webpack config, this work on both, nodejs and browser, take a look:
this is how is working for me.