Plugin/Preset files are not allowed to export objects, only functions

plugin/preset files are not allowed to export objects, only functions babel-preset-flow
error plugin/preset files are not allowed to export objects, only functions in filepath
cannot find module '@babel/preset-es2015'
install @babel/preset-react
cannot find module '@babel/preset-react'
babel-preset-env
babel-loader
this.setdynamic is not a function

I'm getting this error after updating react-native to "^0.56.0":

 bundling failed: Error: Plugin/Preset files are not allowed to export objects, only functions. In /Users/ben/vepo/frontend/node_modules/babel-preset-flow/lib/index.js

I tried to do something similar to the highest voted answer here but instead for babel-preset-flow:

https://github.com/babel/babel-loader/issues/540

.babelrc:

"presets": ["react-native", "flow", "@babel/preset-flow"]

package.json

{
  "name": "vepo",
  "version": "0.0.1",
  "private": true,
  "scripts": {
    "start": "node node_modules/react-native/local-cli/cli.js start",
    "test": "jest"
  },
  "rnpm": {
    "assets": [
      "./app/fonts"
    ]
  },
  "jest": {
    "preset": "react-native",
    "moduleNameMapper": {
      "\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$": "<rootDir>/__mocks__/fileMock.js",
      "\\.(css|less)$": "<rootDir>/__mocks__/styleMock.js"
    }
  },
  "dependencies": {
    "@babel/preset-flow": "^7.0.0-beta.52",
    "@babel/preset-react": "^7.0.0-beta.52",
    "babel-preset-react-native": "^4.0.0",
    "flow-typed": "^2.4.0",
    "generator-rn-toolbox": "^2.2.0",
    "imagemagick": "^0.1.3",
    "immutable": "4.0.0-rc.9",
    "metro-bundler": "^0.22.1",
    "native-base": "^2.3.3",
    "prop-types": "^15.5.10",
    "react": "16.3.1",
    "react-native": "^0.56.0",
    "react-native-aws3": "^0.0.8",
    "react-native-blur": "^3.1.3",
    "react-native-communications": "^2.2.1",
    "react-native-drawer": "^2.3.0",
    "react-native-fbsdk": "facebook/react-native-fbsdk#065507a",
    "react-native-git-upgrade": "^0.2.7",
    "react-native-image-picker": "^0.26.7",
    "react-native-interactable": "^0.1.2",
    "react-native-mail": "^3.0.2",
    "react-native-maps": "^0.16.4",
    "react-native-modal": "^2.3.2",
    "react-native-modalbox": "^1.3.9",
    "react-native-multiple-choice": "^0.0.8",
    "react-native-navigation": "^1.1.100",
    "react-native-off-canvas-menu": "^0.1.31",
    "react-native-optimized-flatlist": "^1.0.1",
    "react-native-redux-router": "^1.0.7",
    "react-native-select-multiple": "^1.0.3",
    "react-native-side-menu": "^0.20.1",
    "react-native-vector-icons": "^4.4.0",
    "react-navigation": "^1.0.0-beta.11",
    "react-redux": "^5.0.3",
    "redux": "^3.6.0",
    "redux-immutable": "^4.0.0",
    "redux-observable": "^0.14.1",
    "reselect": "^3.0.0",
    "rxjs": "^5.2.0",
    "yarn": "^1.3.2",
    "yoga": "^0.0.0"
  },
  "devDependencies": {
    "adm-zip": "^0.4.7",
    "babel-cli": "^6.26.0",
    "babel-eslint": "^7.1.1",
    "babel-plugin-module-resolver": "^2.7.0",
    "eslint": "^3.17.0",
    "eslint-config-prettier": "^2.9.0",
    "eslint-plugin-flowtype": "^2.30.3",
    "eslint-plugin-jsx": "^0.0.2",
    "eslint-plugin-react": "^6.10.0",
    "eslint-plugin-react-native": "^2.3.1",
    "flow-bin": "^0.72.0",
    "plist": "^2.1.0",
    "react-devtools": "^3.2.1",
    "react-test-renderer": "~15.4.1",
    "redux-devtools": "^3.3.2",
    "remote-redux-devtools": "^0.5.7",
    "remotedev-server": "^0.2.4",
    "xcode": "^1.0.0"
  }
}

Nothing is working. Any ideas?

EDIT: there is no node_modules/babel-preset-flow folder at all


I had the same error and resolved it by uninstalling babel-preset-flow and installing @babel/preset-flow. I believe this is due to React Native 56 using Babel 7. And add to .babelrc

{
  "presets": ["@babel/preset-flow"]
}

Preset files are not allowed to export objects, Plugin/Preset files are not allowed to export objects, only functions #8707. Closed. freshcoderchan opened this issue on Sep 13, 2018 · 18 comments. Closed  Module build failed: Error: Plugin/Preset files are not allowed to export objects, only functions.


Upgrade your babel-preset-react-native dependency.

"babel-preset-react-native": "^5",

You don't need to have @babel/preset-react or @babel/preset-flow installed.

Hope this helps.

Babel Plugin/Preset files are not allowed to export objects, only , ERROR in ./index.js Module build failed: Error: Plugin/Preset files are not allowed to export objects, only functions. Does anyone know how to  plugin/preset files are not allowed to export objects only functions 1 React / Sails.js Error: Plugin/Preset files are not allowed to export objects, only functions


Open .babelrc file and then edit the presets section of the code as follows:

  "presets": ["module:metro-react-native-babel-preset"],

Plugin/Preset files are not allowed to export objects, only functions…, I got the same error with babel 7.x and and "babel-loader": "^8.0.4". I solved the issue by changing the following dependencies in package.json. You need to update babel-preset-es2015 to Babel 7. (Actually, the preferred way is to use the @babel/preset-env preset). Also, you shouldn't use babel-preset-react but only @babel/preset-react. If these changes doesn't fix your problem, please post your Babel and webpack config.


I solved this issue by installing "babel-preset-react-native-stage-0" in my project and changed .babelrc file:

"presets": [
    "babel-preset-react-native-stage-0/decorator-support"
  ]

Preset files are not allowed to export objects, Hey,. “React Native Notes 6 : Plugin/Preset files are not allowed to export objects, only functions…” is published by Kuray Ogun in FreakyCoder Software Blog. You can run npx nls why babel-core to understand why it is using Babel 6. Also, don't use Babel 7.0.0-rc since it is a prerelease; use ^7.0.0.. PS. Please wrap the code you post in issues with ``` both before and after the block of code.


for Babel 7 and above and according to this document create a file with name bable.config.js instead of .babelrc and then export presets like this :

const presets = [
    "flow"
]

module.exports = {presets}

If you get: "Test suite failed to run Plugin/Preset files are not allowed , js Module build failed: Error: Plugin/Preset files are not allowed to export objects, only functions. Does anyone know how to solve this? Click to  For me also happened today! while running some test cases! Test suite failed to run Plugin/Preset files are not allowed to export objects, only functions.


Error: plugin/preset files are not allowed to export objects, only , Solution : You are using the combination of the Babel 6 and Babel 7. There is no guarantee of the compatibility across the versions: Module build failed: Error: Plugin/Preset files are not allowed to export objects, only functions. #575 gabrielcarneiro97 opened this issue Feb 7, 2018 · 9 comments Comments


Plugin/Preset files are not allowed to export objects, only functions , Hi. I just updated my app to use SDK 31.0.0. After I did that I get an error when I run the App in Expo Client/simulator: Plugin/Preset files are not  ERROR in./ src / index. js Module build failed (from ./ node_modules / babel-loader / lib / index. js): Error: Plugin / Preset files are not allowed to export objects, only functions. In / Users / xxx / xxx / xxx / node_modules / babel-preset-react / lib / index. js at createDescriptor (/ Users / xxx / xxx / xxx / node_modules / @babel / core


Error: Plugin/Preset files are not allowed to export objects, only , Error: Plugin/Preset files are not allowed to export objects, only functions. In ./​node_modules/babel-preset-stage-3/lib/index.js. jayair September