mirror of https://github.com/status-im/metro.git
Do not use spread operator in require.js implementation
Reviewed By: jeanlauliac Differential Revision: D8074917 fbshipit-source-id: e7c4dca7955f7aeda8b59d2039e857f79168410b
This commit is contained in:
parent
1b15c47c93
commit
adce40d38d
|
@ -18,17 +18,13 @@ const fs = require('fs');
|
|||
|
||||
const {transformSync} = require('@babel/core');
|
||||
|
||||
// from: metro/packages/metro-babel-register/babel-register.js
|
||||
|
||||
const PLUGINS = [
|
||||
'@babel/plugin-transform-flow-strip-types',
|
||||
'@babel/plugin-proposal-object-rest-spread',
|
||||
'@babel/plugin-proposal-class-properties',
|
||||
];
|
||||
// Include the external-helpers plugin to be able to detect if they're
|
||||
// needed when transforming the requirejs implementation.
|
||||
const PLUGINS = ['@babel/plugin-external-helpers'];
|
||||
|
||||
function createBabelConfig() {
|
||||
return {
|
||||
presets: [],
|
||||
presets: [require.resolve('babel-preset-react-native')],
|
||||
plugins: PLUGINS.map(require),
|
||||
retainLines: true,
|
||||
sourceMaps: 'inline',
|
||||
|
@ -56,6 +52,12 @@ describe('require', () => {
|
|||
moduleSystem = {};
|
||||
});
|
||||
|
||||
it('does not need any babel helper logic', () => {
|
||||
// Super-simple check to validate that no babel helpers are used.
|
||||
// This check will need to be updated if https://fburl.com/6z0y2kf8 changes.
|
||||
expect(moduleSystemCode.includes('babelHelpers')).toBe(false);
|
||||
});
|
||||
|
||||
it('works with plain bundles', () => {
|
||||
createModuleSystem(moduleSystem, false);
|
||||
expect(moduleSystem.require).not.toBeUndefined();
|
||||
|
|
|
@ -326,7 +326,7 @@ if (__DEV__) {
|
|||
return false;
|
||||
}
|
||||
|
||||
parents.push(...inverseDependencies[notAccepted[i]]);
|
||||
parents.push.apply(parents, inverseDependencies[notAccepted[i]]);
|
||||
}
|
||||
|
||||
return parents.length == 0;
|
||||
|
|
Loading…
Reference in New Issue