Have been working on a project generated via create-react-native-app
. Have been successfully using the project for some time, but now trying to test the app via exp start --tunnel
, am suddenly seeing error (though was working previously) of the form:
[22:08:19] /path/to/node_modules/react-native-scripts/build/bin/crna-entry.js: Plugin/Preset files are not allowed to export objects, only functions. In /path/to/node_modules/babel-preset-expo/index.js
[22:08:19] Failed building JavaScript bundle.
Have seen some posts that seem to deal with the problem (https://github.com/babel/babel/issues/6808 and Babel Plugin/Preset files are not allowed to export objects, only functions), but am totally new to react-anything and don't fully get what bable
is, so am having difficulty understanding how to apply these posts to my own situation.
My .bablerc file (as it seems to be relevant in the other posts) is:
{
"presets": ["babel-preset-expo"],
"env": {
"development": {
"plugins": ["transform-react-jsx-source"]
}
}
}
Have tried npm cache clean --force && rm -rf node_modules && rm -f package-lock.json && npm install
with no change. What does seem to help is downgrading from react-native@0.56 to 0.55 (as espoused here: Create React Native App. - Plugin/Preset files are not allowed to export objects, only functions), but this does not seem to address the problem directly and more of a workaround. Any advice on what should be done here would be appreciated (any other files that should be included to help debug?).
** In response to this question being marked as a potential duplicate of Create React Native App. - Plugin/Preset files are not allowed to export objects, only functions,
- this question was actually cited in the post and explanation of why this question was posted despite the existence of the other was included in the last paragraph and
- my later answer to this question explains to other users why the downgrade to 0.55 resolves the problem (and cites relevant docs that users can further inspect), which (at the time of this question's posting) was not present in the other cited question (though presently, the user who has marked this question as a duplicate now has an answer in the cited question that does also talk about why the 0.55 downgrade works).