create-universal-package
create-universal-package copied to clipboard
Fails to build saying "Unexpected token, expected "," " when it hits React context component
I found that when I run into this code:
<Foo.Consumer>
{({bar}) => bar
I get an error Unexpected token, expected "," (61:26) which is where the . that splits the Foo and Consumer is. I am guessing that this does not recognize more recent React syntax since removing that makes the error go away.
Facing the same issue, with any JSX
Cup v4 now uses vanilla .babelrc for Babel configuration (rather than .cuprc.js). Configuration loading as of Babel v7 fixed a lot of the issues (the original reasoning for not using .babelrc in the first place). So assuming you have the React Babel preset in there, it will be able to parse these files.