From 322dea8dc700de70aea92cf37614d5fc50e09c6b Mon Sep 17 00:00:00 2001 From: Deepak Jacob Date: Fri, 16 Dec 2022 06:16:21 -0800 Subject: [PATCH] Remove @babel/plugin-transform-template-literals Summary: Remove babel/plugin-transform-template-literals as this is natively supported by, - Hermes - JSC - v8 (Since some community uses v8 too). Ref: - https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_literals#browser_compatibility - http://kangax.github.io/compat-table/es6/ - https://github.com/WebKit/WebKit/blob/923859afb65b75c83b5c6ce68846e14a8e38845d/Source/JavaScriptCore/features.json#L371 Changelog: [Breaking] Removed babel plugin transform-template-literals from metro preset Reviewed By: blakef Differential Revision: D42069641 fbshipit-source-id: e4dfc8234e2a74ab5ed68ed14258bcee03f5b67e --- packages/metro-react-native-babel-preset/package.json | 3 +-- .../metro-react-native-babel-preset/src/configs/main.js | 6 ------ 2 files changed, 1 insertion(+), 8 deletions(-) diff --git a/packages/metro-react-native-babel-preset/package.json b/packages/metro-react-native-babel-preset/package.json index fc3ba4325f..62b1a45724 100644 --- a/packages/metro-react-native-babel-preset/package.json +++ b/packages/metro-react-native-babel-preset/package.json @@ -32,6 +32,7 @@ "@babel/plugin-syntax-nullish-coalescing-operator": "^7.0.0", "@babel/plugin-syntax-optional-chaining": "^7.0.0", "@babel/plugin-transform-arrow-functions": "^7.0.0", + "@babel/plugin-transform-async-to-generator": "^7.0.0", "@babel/plugin-transform-block-scoping": "^7.0.0", "@babel/plugin-transform-classes": "^7.0.0", "@babel/plugin-transform-computed-properties": "^7.0.0", @@ -46,12 +47,10 @@ "@babel/plugin-transform-react-jsx": "^7.0.0", "@babel/plugin-transform-react-jsx-self": "^7.0.0", "@babel/plugin-transform-react-jsx-source": "^7.0.0", - "@babel/plugin-transform-async-to-generator": "^7.0.0", "@babel/plugin-transform-runtime": "^7.0.0", "@babel/plugin-transform-shorthand-properties": "^7.0.0", "@babel/plugin-transform-spread": "^7.0.0", "@babel/plugin-transform-sticky-regex": "^7.0.0", - "@babel/plugin-transform-template-literals": "^7.0.0", "@babel/plugin-transform-typescript": "^7.5.0", "@babel/plugin-transform-unicode-regex": "^7.0.0", "@babel/template": "^7.0.0", diff --git a/packages/metro-react-native-babel-preset/src/configs/main.js b/packages/metro-react-native-babel-preset/src/configs/main.js index b4a7ed02cc..90b42a45d3 100644 --- a/packages/metro-react-native-babel-preset/src/configs/main.js +++ b/packages/metro-react-native-babel-preset/src/configs/main.js @@ -112,12 +112,6 @@ const getPreset = (src, options) => { ], ); } - if (!isHermes && (isNull || src.indexOf('`') !== -1)) { - extraPlugins.push([ - require('@babel/plugin-transform-template-literals'), - {loose: true}, // dont 'a'.concat('b'), just use 'a'+'b' - ]); - } if (isNull || src.indexOf('async') !== -1) { extraPlugins.push([ require('@babel/plugin-proposal-async-generator-functions'),