Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add @babel/plugin-transform-react-jsx #1

Closed
antonio24073 opened this issue Sep 26, 2020 · 3 comments
Closed

Add @babel/plugin-transform-react-jsx #1

antonio24073 opened this issue Sep 26, 2020 · 3 comments

Comments

@antonio24073
Copy link

web app:

`Failed to compile
./node_modules/@eliav2/react-native-collapsible-view/index.js
SyntaxError: .../node_modules/@eliav2/react-native-collapsible-view/index.js: Support for the experimental syntax 'jsx' isn't currently enabled (76:52):

74 | });
75 |

76 | const TitleElement = typeof title === "string" ? {title} : title;
| ^
77 |
78 | useEffect(() => {
79 | // this part is to trigger collapsible animation only after he has been fully mounted so animation would

Add @babel/plugin-transform-react-jsx (https://git.io/vb4yd) to the 'plugins' section of your Babel config to enable transformation.`

@Eliav2
Copy link
Owner

Eliav2 commented Sep 26, 2020

hey @antonio24073, thanks for opening this issue.
I would like to get some more info about this because I did not get it myself, and I want to understand the source of this issue.

  1. what version react-native are you using?
  2. do you use react-native-cli or expo-cli?

please help me reproduce this.

is that related?
https://stackoverflow.com/questions/53327625/cannot-find-module-babel-plugin-transform-react-jsx-source-when-running-react

Edit: After searching a little bit, I found out that after ejecting, you need to delete the whole node_modules and re-run yarn to make it work.
please see:
facebook/create-react-app#6099

@antonio24073
Copy link
Author

antonio24073 commented Sep 26, 2020

react-native-cli 0.63.2 with create-react-native-web-app

Solved

./config/webpack.config.js line 421
plugins: [ "@babel/plugin-transform-react-jsx", "@babel/plugin-proposal-class-properties", [
Execute:
echo "export const ViewPropTypes = { style: null };" >> ../node_modules/react-native-web/dist/index.js
you can create a bash file, add it to package.json to execute with npm

@Eliav2
Copy link
Owner

Eliav2 commented Sep 26, 2020

I don't understand you, friend, be more specific.
if you solved it and it's not related to the package then please close this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants