Babel: Missing class properties transform

Created on 12 Nov 2015  路  3Comments  路  Source: babel/babel

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...

outdated

Most helpful comment

Can you try moving stage-0 down to after es2015.

All 3 comments

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:

http://phabricator.babeljs.io/T2645


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 babelifymodule with browerify in gulp.task.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

hzoo picture hzoo  路  3Comments

catamphetamine picture catamphetamine  路  3Comments

sorrycc picture sorrycc  路  3Comments

tracker1 picture tracker1  路  3Comments

mathiasbynens picture mathiasbynens  路  3Comments