Commit Graph

2 Commits

Author SHA1 Message Date
Daniel Friesen 855c0cc25e Add transform-es2015-function-name to the react-native babel preset. Fixes #6716
Summary:Stateless function components (at least those using arrow functions) are not assigned names when this transform is omitted.

Rebased against master and kept the original author from #6717

cc martinbigio bestander
Closes https://github.com/facebook/react-native/pull/6794

Differential Revision: D3133791

Pulled By: mkonicek

fb-gh-sync-id: bb7790ad17d1520da5ab95580548d29d0c0f397d
fbshipit-source-id: bb7790ad17d1520da5ab95580548d29d0c0f397d
2016-04-13 07:41:26 -07:00
Adam Miskiewicz e6cb02d61a Use "babel-preset-react-native"
Summary:
Rather than specifying Babel plugins in the `.babelrc` packaged with react-native, leverage a Babel preset to define the plugins (https://github.com/exponentjs/babel-preset-react-native).

This allows for a much better user experience for those who want (or need) to override options in their project's `.babelrc`.

Prior to this PR, if a user wanted to use a custom babel-plugin (or a custom set of babel plugins), they'd have either 1) manually override the `.babelrc` in the react-packager directory (or fork RN), or 2) specify a custom transformer to use when running the packager that loaded their own `.babelrc`. Note - the custom transformer was necessary because without it, RN's `.babelrc` options would supersede the options defined in the project's `.babelrc`...potentially causing issues with plugin ordering.

This PR makes the transformer check for the existence of a project-level `.babelrc`, and if it it's there, it _doesn't_ use the react-native `.babelrc`. This prevents any oddities with Babel plug
Closes https://github.com/facebook/react-native/pull/5214

Reviewed By: davidaurelio

Differential Revision: D2881814

Pulled By: martinbigio

fb-gh-sync-id: 4168144b7a365fae62bbeed094d8a03a48b4798c
2016-02-03 08:15:32 -08:00