gpt4 book ai didi

javascript - react native v0.56 : Cannot read property 'filename' of undefined at PluginPass. JSXOpeningElement

转载 作者:数据小太阳 更新时间:2023-10-29 04:00:10 26 4
gpt4 key购买 nike

我刚刚将 React Native 从 0.55 更新到 0.56。

但是,当我尝试运行代码(react-native run-android 或 run-ios)时,捆绑停止到这一点:

Loading dependency graph, done.
error: bundling failed: TypeError: Cannot read property 'filename' of undefined
at PluginPass.JSXOpeningElement ({path_to_my_project}/react-native/node_modules/babel-plugin-transform-react-jsx-source/lib/index.js:32:39)

这是我的 .babelrc:

{
"presets": [
"react-native"
],
"env": {
"development": {
"plugins": [
"transform-react-jsx-source"
]
}
}
}

和 package.json

"dependencies": {
"babel-jest": "23.4.2",
"babel-preset-react-native": "5.0.2",
"react": "16.4.1",
"react-native": "0.56.0",
}

我已经删除了 node_modules 文件夹并重新安装了软件包,但没有成功。

有什么建议吗?任何帮助,将不胜感激!

最佳答案

我删除了

"env": {
"development": {
"plugins": [
"transform-react-jsx-source"
]
}
}

来自 .babelrc 并且它有效。

所以我的 .babelrc 最后看起来像

{ "presets": ["react-native"] }

关于javascript - react native v0.56 : Cannot read property 'filename' of undefined at PluginPass. JSXOpeningElement,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51765313/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com