[英]React Native cannot resolve babel plugin
Error Message错误信息
Unknown plugin \\"require-all\\" specified in "\\project\\directory\\path\\.babelrc.env.development" “\\project\\directory\\path\\.babelrc.env.development”中指定的未知插件\\“require-all\\”
My files我的文件
.babelrc .babelrc
{
"presets": ["babel-preset-expo"],
"env": {
"development": {
"plugins": ["transform-react-jsx-source", "require-all"]
}
}
}
package.json包.json
{
"name": "text-adventure-app",
"version": "0.1.0",
"private": true,
"devDependencies": {
"babel-plugin-require-all": "0.0.1",
"jest-expo": "~27.0.0",
"react-native-scripts": "1.14.0",
"react-test-renderer": "16.3.1"
},
"main": "./node_modules/react-native-scripts/build/bin/crna-entry.js",
"scripts": {
"start": "react-native-scripts start",
"eject": "react-native-scripts eject",
"android": "react-native-scripts android",
"ios": "react-native-scripts ios",
"test": "jest"
},
"jest": {
"preset": "jest-expo"
},
"dependencies": {
"clear": "^0.1.0",
"create-react-class": "^15.6.3",
"expo": "^27.0.1",
"react": "16.3.1",
"react-native": "~0.55.2",
"react-native-typewriter": "^0.5.3"
}
}
babel-plugin-require-all babel-plugin-require-all
installed via npm as described here: https://github.com/dushaobindoudou/babel-plugin-require-all通过 npm 安装,如下所述: https : //github.com/dushaobindoudou/babel-plugin-require-all
What I've tried我试过的
There is a problem in the package.json
for that plugin - there is an extra该插件的
package.json
存在问题 - 有一个额外的(space) in the
main
property which means babel can't resolve it. (space) 在
main
属性中,这意味着 babel 无法解析它。 I verified this by removing the space from the end of the line, and it successfully compiles.我通过从行尾删除空格来验证这一点,并且它成功编译。
My advice in this case would be to use a different package (maybe something like https://github.com/vihanb/babel-plugin-wildcard could help) or submit a pull request to the babel-plugin-require-all
package to remove the extra space.在这种情况下,我的建议是使用不同的包(也许像https://github.com/vihanb/babel-plugin-wildcard 之类的东西可能会有所帮助)或向
babel-plugin-require-all
包提交拉取请求以删除多余的空间。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.