-
-
Notifications
You must be signed in to change notification settings - Fork 85
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
.cjs does not work with React Native and/or Expo #233
Comments
It really seems like the Metro bundler/Expo problem. While we could "fix" this on our side this should definitely be fixed on theirs as .cjs will become more common in the ecosystem in the future. |
there's an issue open on the metro repo facebook/metro#535 builds work fine again for me after adding this to my metro config:
|
Workaround for metro deficiency: facebook/metro#535 Caused by stylis shipping a .cjs file: thysultan/stylis#233 Fix from emotion-js/emotion#1986
Workaround for metro deficiency: facebook/metro#535 Caused by stylis shipping a .cjs file: thysultan/stylis#233 Fix from emotion-js/emotion#1986
Unfortunately none of the work-arounds floating about are working for me on an Expo project, so this issue is blocking the upgrade to Emotion 11. It makes sense to me that it's a Metro / Expo problem, but I haven't been able to find any indication that they intend to fix it on their end or that it's even on their radar since facebook/metro#535 hasn't gotten any responses 😞 |
@hueter for Expo you have to change your {
"expo": {
...
"packagerOpts": {
"sourceExts": ["cjs"]
}
} |
@efoken oh nice, that just worked. Thank you. I couldn't find docs for that anywhere but I'm glad it was that easy |
Hi, all |
@sounisi5011/ts-utils-is-property-accessible uses the `.cjs` extension. It may not work because of this. see thysultan/stylis#233 (comment)
If you are using expo SDK >41 try this metro.config.js(create the file if it does not exist) in your root folder. const { getDefaultConfig } = require('expo/metro-config'); |
I tried adding a metro config as below const { getDefaultConfig } = require('expo/metro-config'); well it works but its brings errors when I use moti.fly... reanimated error. any fix on this issue?? |
|
This fixed the issue for me. I looked everywhere and this finally got my iOS build working. Anyone with same issue, ensure you have file in root folder (metro.config.js) and use this code with extension that is not recognized ( in my case it was cjs). Thank you for this solution! |
This fiexed the issue for me too. I tried to fix this finally got my expo Android build working. I fixed the error. Thank you. Error message is
|
mines still not working can i get the documentation on 9.6.11 version so i can use different version |
mine isn't working even after adding the metro.config.js file |
This fixed if for me as well. Thank you! |
Since the latest version, which changed the file extension to
.cjs
, it does not work anymore with React Native. I'm getting the following error:The text was updated successfully, but these errors were encountered: