Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

React.js Decorators are not supported yet in 6.x pending proposal update

The technologies that i am using to build my app is React, Web-pack, Babel and AlT(flux implementation)

I'm getting an error when web pack tries to compile my app. Not sure what libraries i am missing.

Could someone please advice ?

  ##.babelrc file##
  {"presets": ["react", "es2015", "stage-0"]}

Screen Shot

like image 411
Erkan Demir Avatar asked Nov 23 '15 10:11

Erkan Demir


3 Answers

The answer is mostly provided here https://stackoverflow.com/a/34210231/, but I'll recount it here for convenience:

Basically, you TC39 is changing the proposal so Babel is holding off on implementing decorators. If you want the Babel 5 version of decorators (or something similar), you can add this special plugin to Babel - https://www.npmjs.com/package/babel-plugin-transform-decorators-legacy.

like image 82
Qiming Avatar answered Nov 16 '22 03:11

Qiming


Babel 6 doesn't support decorators yet, see this issue

The easiest and most stable solution at the moment is use version 5.8.34

like image 40
Emilio Rodriguez Avatar answered Nov 16 '22 02:11

Emilio Rodriguez


The TC39 is changing the decorator proposal (the 'old' one is implemented in babel 5), so the babel team is waiting them to write the new implementation, or port the old one from babel 5. The easy way to use decorators now is use babel 5, then wait to TC39 for the new proposal and let the babel team implement it.

like image 33
Alejandro Silva Avatar answered Nov 16 '22 03:11

Alejandro Silva