From 1adb318589955a5f7bb0d6373b1ab98de8243da4 Mon Sep 17 00:00:00 2001 From: David Aurelio Date: Tue, 2 May 2017 05:28:15 -0700 Subject: [PATCH] Separate node polyfills from runtime transforms Summary: Separates the polyfills used for node.js from the configuration of `babel-register`, to make pretransforming packager before invoking it easier. Reviewed By: cpojer Differential Revision: D4978047 fbshipit-source-id: 45d3d49d0a714a8257be8d244a01e41b68bbce3d --- packager/babelRegisterOnly.js | 4 +--- packager/setupNodePolyfills.js | 14 ++++++++++++++ 2 files changed, 15 insertions(+), 3 deletions(-) create mode 100644 packager/setupNodePolyfills.js diff --git a/packager/babelRegisterOnly.js b/packager/babelRegisterOnly.js index 56fa8c328..1a0b2df4c 100644 --- a/packager/babelRegisterOnly.js +++ b/packager/babelRegisterOnly.js @@ -8,9 +8,7 @@ */ 'use strict'; -Array.prototype.values || require('core-js/fn/array/values'); -Object.entries || require('core-js/fn/object/entries'); -Object.values || require('core-js/fn/object/values'); +require('./setupNodePolyfills'); var _only = []; diff --git a/packager/setupNodePolyfills.js b/packager/setupNodePolyfills.js new file mode 100644 index 000000000..ac1514309 --- /dev/null +++ b/packager/setupNodePolyfills.js @@ -0,0 +1,14 @@ +/** + * Copyright (c) 2017-present, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + */ + +'use strict'; + +Array.prototype.values || require('core-js/fn/array/values'); +Object.entries || require('core-js/fn/object/entries'); +Object.values || require('core-js/fn/object/values');