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

Failed to start project if .babelrc is added #4882

Closed
am5a03 opened this issue Dec 20, 2015 · 3 comments
Closed

Failed to start project if .babelrc is added #4882

am5a03 opened this issue Dec 20, 2015 · 3 comments
Labels
Resolution: Locked This issue was locked by the bot.

Comments

@am5a03
Copy link

am5a03 commented Dec 20, 2015

I've added a .babelrc in my project's root directory

{
  "whitelist": [
    "es7.classProperties",
    "es7.decorators"
  ]
}

It cannot be started, I got the same error message as in #4690

C:\Users\Raymond\workspace\ReactNativeProjs\JGolden\node_modules\babel-core\lib\transformation\file\logger.js:41
    throw new Constructor(this._buildMessage(msg));
    ^

ReferenceError: [BABEL] C:\Users\Raymond\workspace\ReactNativeProjs\JGolden\node_modules\react-native\local-cli\bundle\bundle.js: Unknown option: base.whitelist
    at Logger.error (C:\Users\Raymond\workspace\ReactNativeProjs\JGolden\node_modules\babel-core\lib\transformation\file\logger.js:41:11)
    at OptionManager.mergeOptions (C:\Users\Raymond\workspace\ReactNativeProjs\JGolden\node_modules\babel-core\lib\transformation\file\options\option-manager.js:262:18)
    at OptionManager.init (C:\Users\Raymond\workspace\ReactNativeProjs\JGolden\node_modules\babel-core\lib\transformation\file\options\option-manager.js:416:10)
    at File.initOptions (C:\Users\Raymond\workspace\ReactNativeProjs\JGolden\node_modules\babel-core\lib\transformation\file\index.js:191:75)
    at new File (C:\Users\Raymond\workspace\ReactNativeProjs\JGolden\node_modules\babel-core\lib\transformation\file\index.js:122:22)
    at Pipeline.transform (C:\Users\Raymond\workspace\ReactNativeProjs\JGolden\node_modules\babel-core\lib\transformation\pipeline.js:42:16)
    at Object.transformFileSync (C:\Users\Raymond\workspace\ReactNativeProjs\JGolden\node_modules\babel-core\lib\api\node.js:116:10)
    at compile (C:\Users\Raymond\workspace\ReactNativeProjs\JGolden\node_modules\babel-register\lib\node.js:102:20)
    at loader (C:\Users\Raymond\workspace\ReactNativeProjs\JGolden\node_modules\babel-register\lib\node.js:130:14)
    at Object.require.extensions.(anonymous function) [as .js] (C:\Users\Raymond\workspace\ReactNativeProjs\JGolden\node_modules\babel-register\lib\node.js:140:7)

However, this .babelrc works in one of my previous projects, which is using react-native 0.14.2
Here is an excerpt of the dependency of this new project:

PS C:\Users\Raymond\workspace\ReactNativeProjs\JGolden> npm ls
JGolden@0.0.1 C:\Users\Raymond\workspace\ReactNativeProjs\JGolden
└─┬ react-native@0.17.0
  ├── absolute-path@0.0.0
  ├── art@0.10.0
  ├─┬ babel-core@6.3.21
  │ ├─┬ babel-code-frame@6.3.13

And the dependency of my old project

├─┬ react-native@0.14.2
│ ├── absolute-path@0.0.0
│ ├─┬ babel@5.8.34

Both are using exactly the same .babelrc, but the new project simply doesn't start.
I tried to copy node_modules to my new project, and it starts.

@facebook-github-bot
Copy link
Contributor

Hey am5a03, thanks for reporting this issue!

React Native, as you've probably heard, is getting really popular and truth is we're getting a bit overwhelmed by the activity surrounding it. There are just too many issues for us to manage properly.

  • If you don't know how to do something or not sure whether some behavior is expected or a bug, please ask on StackOverflow with the tag react-native or for more real time interactions, ask on Discord in the #react-native channel.
  • If this is a feature request or a bug that you would like to be fixed, please report it on Product Pains. It has a ranking feature that lets us focus on the most important issues the community is experiencing.
  • We welcome clear issues and PRs that are ready for in-depth discussion. Please provide screenshots where appropriate and always mention the version of React Native you're using. Thank you for your contributions!

@ms88privat
Copy link

@am5a03 since v0.16.0 React Native uses BABEL6, which currently does not support decorators, so they will not work. From the Release notes: JS decorators won't work until T2645 lands in Babel. It's being worked on. The proposal for decorators is not final and therefore Babel 6 left decorator support out for now.

And since then also .barbelrc are not supported anymore. You have to remove them from any other node_module too. Please have a look at this related issue #4062

@christopherdro
Copy link
Contributor

Closing for #4062

@facebook facebook locked as resolved and limited conversation to collaborators Jul 20, 2018
@react-native-bot react-native-bot added the Resolution: Locked This issue was locked by the bot. label Jul 20, 2018
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

5 participants