Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[0.56.0-rc-2] Decorator support broken #19789

Closed
alexwasner opened this issue Jun 18, 2018 · 5 comments
Closed

[0.56.0-rc-2] Decorator support broken #19789

alexwasner opened this issue Jun 18, 2018 · 5 comments
Labels
Resolution: Locked This issue was locked by the bot.

Comments

@alexwasner
Copy link

alexwasner commented Jun 18, 2018

Environment

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

Description

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"
  },

Reproducible Demo

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
@vovkasm
Copy link
Contributor

vovkasm commented Jun 18, 2018

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 )

@jshearer
Copy link

I solved this by using

"babel-plugin-transform-decorators-legacy": "^1.3.5",

and

"plugins": [
    "transform-decorators-legacy",
]

In my .babelrc file.

@hramos
Copy link
Contributor

hramos commented Jun 19, 2018

@alexwasner OK to close this issue?

@fwh1990
Copy link

fwh1990 commented Jun 21, 2018

@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

@kelset
Copy link
Contributor

kelset commented Jun 21, 2018

This is not a bug caused by the changes in the default config.

It’ll be impossible to account for custom configs since it’s certain that some third party plugins will break in babel 7, and it’s 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.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Resolution: Locked This issue was locked by the bot.
Projects
None yet
Development

No branches or pull requests

7 participants