Erkan Demir
Erkan Demir

Reputation: 795

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

Upvotes: 15

Views: 8140

Answers (4)

WEN-JY
WEN-JY

Reputation: 913

I had the same problem, and after I removed duplicated declaration of

"presets: ['es2015', 'react','stage-0'],"

in webpack config and .babelrc,it finnaly works.

Upvotes: 0

Qiming
Qiming

Reputation: 1744

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.

Upvotes: 9

Alejandro Silva
Alejandro Silva

Reputation: 9118

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.

Upvotes: 2

Emilio Rodriguez
Emilio Rodriguez

Reputation: 5749

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

Upvotes: 7

Related Questions