在 createreactnativeapp 元素中突然看到错误PluginPreset files are not allowed to export objects, only functions
一直在从事一个通过create-react-native-app
生成的项目.已经成功使用该项目一段时间了,但现在正试图通过exp start --tunnel
测试该应用程序,我突然发现表单出现错误(尽管之前一直在工作):
[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.
我已经看到一些帖子似乎在处理这个问题(https://github.com/babel/babel/issues/6808和Babel Plugin/Preset files are not allowed to export objects, only functions),但我对任何事情都没有react ,也没有完全理解bable
是什么,所以我很难理解如何将这些帖子应用到我自己的情况.
我的bablerc文件(似乎与其他帖子相关)是:
{
"presets": ["babel-preset-expo"],
"env": {
"development": {
"plugins": ["transform-react-jsx-source"]
}
}
}
我试过npm cache clean --force && rm -rf node_modules && rm -f package-lock.json && npm install
,但没有改变.What does seem to help is downgrading from react-native@0.56 to 0.55(正如这里所支持的:Create React Native App. - Plugin/Preset files are not allowed to export objects, only functions),但这似乎并没有直接解决这个问题,更像是workaround.如果您对这里应该做什么有任何建议,我们将不胜感激(是否应该包括任何其他文件以帮助调试?).
**针对这个问题被标记为Create React Native App. - Plugin/Preset files are not allowed to export objects, only functions的潜在副本,
- 这个问题实际上在帖子中被引用了,最后一段和最后一段解释了为什么尽管存在另一个问题,这个问题还是被贴了出来
- 我稍后对this个问题的回答向其他用户解释了why降级到0.55解决了问题(并引用了用户可以进一步判断的相关文档),在另一个引用的问题中(该问题的at the time条帖子)没有出现(尽管目前,将该问题标记为重复问题的用户现在在引用的问题中有一个答案,该答案也提到了0.55降级的原因).