react: React cannot be compiled with latest Google Closure Compiler
When trying to compile React 15.3.1 with the latest Closure Compiler, the following output is produced:
react.js:13694: WARNING - Misplaced @abstract annotation. only functions or non-static methods can be abstract
getTransactionWrappers: function () {
^
react.js:14161: WARNING - Misplaced @abstract annotation. only functions or non-static methods can be abstract
getTransactionWrappers: function () {
^
react.js:16952: WARNING - Misplaced @abstract annotation. only functions or non-static methods can be abstract
getTransactionWrappers: null,
^
react.js:4782: ERROR - @nosideeffects may only appear in externs files.
render: SpecPolicy.DEFINE_ONCE,
^
1 error(s), 3 warning(s)
The last one is an errors, the others are warnings. To reproduce:
$> wget https://dl.google.com/closure-compiler/compiler-latest.zip
$> unzip compiler-latest.zip
$> wget https://cdnjs.cloudflare.com/ajax/libs/react/15.3.2/react.js
$> java -jar closure-compiler-*.jar --js react.js
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Reactions: 16
- Comments: 40 (6 by maintainers)
Commits related to this issue
- Remove all Google Closure Compiler annotations. See #7551. — committed to ChadBurggraf/react by ChadBurggraf 8 years ago
@gaearon now i’m working on removing GCC anotations and plan to create pr tomottow or day after
create-react-class@15.6.0is out with fixes.Hi, just bumped into this. After removing the
@nosideeffectsannotation I compiled my code successfully and managed to reduce the size of my app about 20%. https://github.com/facebook/react/blob/master/src/isomorphic/classic/class/ReactClass.js#L172I see there’s a commit above but there doesn’t seem to be a PR (?), happy to contribute if needed.
Probably I can do it
@gaearon i will do it
Thank you
Fixed via #8882
No, sorry. Removing the
@nosideeffectsannotation fromReactClass.jswill make it compile, but I’m not sure if that’s a valid fix. I tried to find some clue in the commit history as to who added the annotation and when, but it was already present in the “Initial public release” commit.