错误消息
在“ \ project \ directory \ path \ .babelrc.env.development”中指定的未知插件\“ require-all \”
我的文件
.babelrc
{
"presets": ["babel-preset-expo"],
"env": {
"development": {
"plugins": ["transform-react-jsx-source", "require-all"]
}
}
}
package.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
通过npm安装,如下所示: https://github.com/dushaobindoudou/babel-plugin-require-all
我尝试过的事情
答案 0 :(得分:1)
该插件的package.json
中存在问题-属性中有一个额外的
main
(空格),这意味着babel无法解决它。我通过从行尾删除空格来验证了这一点,并且它可以成功编译。
在这种情况下,我的建议是使用其他程序包(也许像https://github.com/vihanb/babel-plugin-wildcard这样可以解决问题)或向babel-plugin-require-all
程序包提交拉取请求,以删除多余的空间。