Getting this error using Babel 6
SyntaxError: MyClass.js: Missing class properties transform.
29 |
30 | class MyClass extends React.Compoennt {
> 31 | static propTypes = {
| ^
with the babelrc like this. I heard the order was important?
{
"presets": [
"stage-0",
"es2015",
"react"
]
}
"babel": "^6.0.15",
"babel-cli": "^6.1.4",
"babel-preset-es2015": "^6.1.4",
"babel-preset-react": "^6.1.4",
"babel-preset-stage-0": "^6.1.2",
class properties are inside stage-1 which is imported by stage-0... So I'm not sure to understand why I get this error...
Can you try moving stage-0
down to after es2015
.
Indeed, it works if stage-0
is after es2015
.
Comment originally made by @ericclemmons on 2015-12-22T16:42:17.000Z
Google brought me here with the same issue.
Unfortunately, there's a different error depending on the order I use:
"presets": ["stage-0", "es2015", "react"],
Missing class properties transform.
Versus:
"presets": ["es2015", "stage-0", "react"],
Decorators are not supported yet in 6.x pending proposal update.
Comment originally made by @ericclemmons on 2015-12-22T16:50:26.000Z
Ah, so the change fixes the first behavior, but reveals an error due to lack of decorator support here:
Comment originally made by @JackieLs on 2016-02-25T05:05:44.000Z
I`ve solved it like this.
transform('babelify',{presets: ['react','es2015','stage-0']})
this is the order when I use the babelify
module with browerify in gulp.task.
Most helpful comment
Can you try moving
stage-0
down to afteres2015
.