babel-preset-react-native-stage-0
babel-preset-react-native-stage-0 copied to clipboard
plugin/preset files are not allowed to export objects only functions
this is happening on a brand new project what am i doing wrong im new to native
My error message:
error: bundling failed: Error: Plugin/Preset files are not allowed to export objects, only functions. In /path/to/project/node_modules/babel-preset-react-native-stage-0/decorator-support.js
babel-preset-react-native-stage-0's code:
decorator-support.js
module.exports = {
presets: [require('babel-preset-react-native')],
plugins: [
require('babel-plugin-transform-decorators-legacy').default,
require('babel-plugin-transform-do-expressions'),
require('babel-plugin-transform-function-bind'),
require('babel-plugin-transform-class-constructor-call'),
require('babel-plugin-transform-export-extensions'),
require('babel-plugin-syntax-trailing-function-commas'),
require('babel-plugin-transform-exponentiation-operator'),
]
}
Babel handbook document - making your own preset
module.exports = {
presets: [
require("babel-preset-es2015"),
require("babel-preset-react")
],
plugins: [
require("babel-plugin-transform-flow-strip-types")
]
};
It IS the same, I'm confused why it won't build.
I'm guessing the latest version of babel-preset-react-native-stage-0 is doing something that its not supposed to.
I've downgraded to "react-native": "0.55.0"
and it worked.
ah so its the latest version of rn or did they upgrade their version of babel preset and broke it?
thanks for letting me know
@skevy WIll you update this preset to babel 7?
I have the same issue, I think is probably related to Babel Issue 6808
Unless your React Native project uses experimental Javascript, you can resolve this problem by installing babel-preset-react-native@5
and replacing "babel-preset-react-native-stage-0/decorator-support" with "babel-preset-react-native" in the project's .babelrc file.
Any solution for experimental Javascript?
@lorenc-tomasz Adding the plugins you need directly to your .babelrc file ought to work, as long as they're Babel 7 compatible. See the list of transformation plugins in Babel 7.
Some solution right now?
It's almost the end of January'19, any progress?
@fagerbua 's solution worked for me!! And I prefer it to @rankun203 's answer, as dealing with changing react-native's version especially when you are so far into the project, can lead to just so much work and configurations.