From ae11993d0f6c6de661867b5d032d844e91c83c6f Mon Sep 17 00:00:00 2001 From: Christoph Nakazawa Date: Mon, 11 Feb 2019 14:06:36 -0800 Subject: [PATCH] Add a Metro configuration with inline require/import Summary: We have been working on turning on inline-requires/imports and RAM bundles for React Native for a long time, however we have not made real progress on making it the default, even though it is easy. In this diff I am adding a Metro configuration to a new React Native template with the defaults set to `false` (off). This means that everyone creating a new project now or upgrading from an existing one will receive this template file. In a future release of React Native we will turn this setting on to default. From then on, new projects will be using inline-requires while existing ones that are upgrading can make an explicit choice when they are diffing their template and the latest version of it. This approach was outlined in https://github.com/react-native-community/discussions-and-proposals/blob/master/core-meetings/2018-09-metro-meeting.md#actions-that-will-be-taken Note: There is a weird lint-ignore thing in there like in the other template files. I'm working on getting rid of that separately. Reviewed By: TheSavior Differential Revision: D14030370 fbshipit-source-id: cf4c5551c795f2ea0fd1b731b352489f04b8c22e --- template/metro.config.js | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 template/metro.config.js diff --git a/template/metro.config.js b/template/metro.config.js new file mode 100644 index 00000000000..0142a8a8378 --- /dev/null +++ b/template/metro.config.js @@ -0,0 +1,18 @@ +/** + * Metro configuration for React Native + * https://github.com/facebook/react-native + * + * @format + * @lint-ignore-every XPLATJSCOPYRIGHT1 + */ + +module.exports = { + transformer: { + getTransformOptions: async () => ({ + transform: { + experimentalImportSupport: false, + inlineRequires: false, + }, + }), + }, +};