Run react-native info in your terminal and paste its contents here.
React Native Environment Info:
System:
OS: macOS High Sierra 10.13.4
CPU: x64 Intel(R) Core(TM) i7-7820HQ CPU @ 2.90GHz
Memory: 148.02 MB / 16.00 GB
Shell: 5.3 - /bin/zsh
Binaries:
Node: 8.11.2 - /usr/local/bin/node
Yarn: 1.6.0 - /usr/local/bin/yarn
npm: 6.1.0 - /usr/local/bin/npm
Watchman: 4.9.0 - /usr/local/bin/watchman
SDKs:
iOS SDK:
Platforms: iOS 11.3, macOS 10.13, tvOS 11.3, watchOS 4.3
IDEs:
Android Studio: 3.0 AI-171.4443003
Xcode: 9.3.1/9E501 - /usr/bin/xcodebuild
npmPackages:
react: ^16.3.2 => 16.4.1
react-native: ^0.56.0-rc.2 => 0.56.0-rc.2
npmGlobalPackages:
eslint-plugin-react-native: 3.2.1
react-native-cli: 2.0.1
react-native-git-upgrade: 0.2.7
After upgrading to RN56, I am receiving a red screen for error:(...node-modules/react-native-Libraries/react-native/react-native-implementation.js: Cannot find module 'react-native-stage-0/decorator-support'....
My .babelrc file is as follows and worked on previous versions:
{
"presets": [
"react-native",
"react-native-stage-0/decorator-support"
],
"plugins": [
"transform-decorators-legacy"
],
"sourceMaps": true
}
Dev deps in package.json
"devDependencies": {
"babel-eslint": "^8.2.3",
"babel-jest": "21.2.0",
"babel-preset-react-native": "5.0.2",
"babel-preset-react-native-stage-0": "^1.0.1",
"eslint": "^4.19.1",
"eslint-plugin-eslint-comments": "^2.0.2",
"eslint-plugin-flowtype": "^2.49.3",
"eslint-plugin-jest": "^21.17.0",
"eslint-plugin-prettier": "^2.6.0",
"eslint-plugin-react-native": "^3.2.1",
"jest": "21.2.1",
"react-test-renderer": "^16.4.1"
},
Use provided .babelrc on a 0.56.0-rc2 project
react-native init example --version="0.56.0-rc.2"
cd ./example
yarn add --dev babel-preset-react-native-stage-0
RN 0.56 uses babel 7, but babel-preset-react-native-stage-0 clearly depends on babel 6, see: https://github.com/skevy/babel-preset-react-native-stage-0/blob/master/package.json#L10-L18
It will not work )
I solved this by using
"babel-plugin-transform-decorators-legacy": "^1.3.5",
and
"plugins": [
"transform-decorators-legacy",
]
In my .babelrc file.
@alexwasner OK to close this issue?
@jshearer
No, you should install @babel/plugin-proposal-decorators for babel 7. The plugin you use was for babel 6
And babel had change it's package prefix to @babel since babel-7-beta.4. You can see babel github here
This is not a bug caused by the changes in the default config.
It鈥檒l be impossible to account for custom configs since it鈥檚 certain that some third party plugins will break in babel 7, and it鈥檚 up to the plugin authors to fix them/users to change their config.
And thanks to suggestions from @jshearer and @fwh1990 I think we can close this but not lock for a bit, so that the conv about how to properly tackle can move forward.
Most helpful comment
RN 0.56 uses babel 7, but babel-preset-react-native-stage-0 clearly depends on babel 6, see: https://github.com/skevy/babel-preset-react-native-stage-0/blob/master/package.json#L10-L18
It will not work )