-
Notifications
You must be signed in to change notification settings - Fork 87
Incorrect advice for ES6 default value import? #46
Comments
Hey! See the message in the doc. Is your project using true es6 or simulated es6 through webpack/babel? The advice only applies to the latter |
Hi, I generated the project with https://github.com/reasonml-community/reason-scripts. That should be simulated es6, right? |
cc @rrdelaney ^ does reason-script/cra detect es6 support and use the real one? |
@chenglou @rrdelaney I ran into something similar when trying to bind react-native-splash-screen. In my .js component this is easy:
I tried writing the equivalent in my Reason component (after reading the docs):
This transpiles to:
Which should work BUT I tried to Reason my way through this with:
but that transpiles to:
which crashes complaining about undefined at 0. I hassled the people on the Reason discord, they provided me with this solution:
Which totally works! Maybe this will help you too? I think it should be added to the docs but unsure if the proper place is in the Reason docs or the BuckleScript docs.. |
Hi, I just hit the error documented here: https://bucklescript.github.io/docs/en/import-export.html#import-an-es6-default-value. I was trying to import this: https://github.com/chenglou/react-spinner
I tried the suggested fix:
However it didn't work for me, I kept getting the same error. What worked in the end was this:
I suspect (but I'm not sure) this is because the exported value is a class? If we can identify the cause of the problem we can update the documentation.
The text was updated successfully, but these errors were encountered: