Closed tryer3000 closed 8 years ago
Well, I've just learnt that: It's a feature of es6 stage0.
you probably just didn't install the babel presets, or something.
babel does implement arrow functions.
Check this page: http://jamesknelson.com/using-es6-in-the-browser-with-babel-6-and-webpack/ You need to add "stage-0" preset
module: {
loaders: [
{
loader: "babel-loader",
// Skip any files outside of your project's `src` directory
include: [
path.resolve(__dirname, "src"),
],
// Only run `.js` and `.jsx` files through Babel
test: /\.jsx?$/,
// Options to configure babel with
query: {
plugins: ['transform-runtime'],
presets: ['es2015', 'stage-0', 'react'],
}
},
]
}
Hi @belal-mazlom,
the article is kind of outdated. Arrow-Functions are currently supported in babel by using es2015. You can see the implementation details of the generator here (for the beta) or here for the current stable. Stage-0 is not needed to transform for arrow anymore. You can just add it to .babelrc.
this issue has been closed for three years. please don't spam it with works for me.
first, I'm new to front-end, so this may not be a problem of this generator
arrow function fails to build.
Insert the following code into AppComponent
This work in babel 5