From 855c0cc25ea0456fa5813cc65fce09786b557d0f Mon Sep 17 00:00:00 2001 From: Daniel Friesen Date: Wed, 13 Apr 2016 07:40:47 -0700 Subject: [PATCH] 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 --- babel-preset/configs/main.js | 1 + babel-preset/package.json | 1 + babel-preset/plugins.js | 1 + 3 files changed, 3 insertions(+) diff --git a/babel-preset/configs/main.js b/babel-preset/configs/main.js index 3322812bd..84db8d99f 100644 --- a/babel-preset/configs/main.js +++ b/babel-preset/configs/main.js @@ -18,6 +18,7 @@ module.exports = { 'syntax-class-properties', 'syntax-trailing-function-commas', 'transform-class-properties', + 'transform-es2015-function-name', 'transform-es2015-arrow-functions', 'transform-es2015-block-scoping', 'transform-es2015-classes', diff --git a/babel-preset/package.json b/babel-preset/package.json index 8e667c782..772c6b89d 100644 --- a/babel-preset/package.json +++ b/babel-preset/package.json @@ -22,6 +22,7 @@ "babel-plugin-syntax-jsx": "^6.5.0", "babel-plugin-syntax-trailing-function-commas": "^6.5.0", "babel-plugin-transform-class-properties": "^6.5.0", + "babel-plugin-transform-es2015-function-name": "^6.5.0", "babel-plugin-transform-es2015-arrow-functions": "^6.5.0", "babel-plugin-transform-es2015-block-scoping": "^6.5.0", "babel-plugin-transform-es2015-classes": "^6.5.0", diff --git a/babel-preset/plugins.js b/babel-preset/plugins.js index b24a31a3b..b11bcb81a 100644 --- a/babel-preset/plugins.js +++ b/babel-preset/plugins.js @@ -14,6 +14,7 @@ module.exports = { 'babel-plugin-syntax-class-properties': require('babel-plugin-syntax-class-properties'), 'babel-plugin-syntax-trailing-function-commas': require('babel-plugin-syntax-trailing-function-commas'), 'babel-plugin-transform-class-properties': require('babel-plugin-transform-class-properties'), + 'babel-plugin-transform-es2015-function-name': require('babel-plugin-transform-es2015-function-name'), 'babel-plugin-transform-es2015-arrow-functions': require('babel-plugin-transform-es2015-arrow-functions'), 'babel-plugin-transform-es2015-block-scoping': require('babel-plugin-transform-es2015-block-scoping'), 'babel-plugin-transform-es2015-classes': require('babel-plugin-transform-es2015-classes'),