1
votes

Error Message

Unknown plugin \"require-all\" specified in "\project\directory\path\.babelrc.env.development"

My files

.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

installed via npm as described here: https://github.com/dushaobindoudou/babel-plugin-require-all

What I've tried

  • Changing "require-all" to "babel-plugin-require-all"
  • Deleting and re-installing my node_modules
  • Clearing npm cache
  • Scoured the internet for advice on including babel plugins
1
I installed babel through this url : https://www.codecademy.com/articles/react-setup-ii . They have explained really well, go through the process might be of some help for you.Zuha Karim
Thanks for the link Zuha, informative regarding Babel settup, but unfortunately doesn't touch on plugins :/Dale_Plante

1 Answers

1
votes

There is a problem in the package.json for that plugin - there is an extra (space) in the main property which means babel can't resolve it. 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.