Skip to content

Commit

Permalink
Build Tooling: Avoid using spread for objects to work with all node 8…
Browse files Browse the repository at this point in the history
….x versions (#7043)
  • Loading branch information
gziolo authored May 31, 2018
1 parent ed26e0f commit 6c8ab9b
Showing 1 changed file with 26 additions and 20 deletions.
46 changes: 26 additions & 20 deletions bin/packages/get-babel-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,26 +20,32 @@ const plugins = map( babelDefaultConfig.plugins, ( plugin ) => {
} );

const babelConfigs = {
main: {
...babelDefaultConfig,
babelrc: false,
plugins,
presets: map( babelDefaultConfig.presets, ( preset ) => {
if ( isArray( preset ) && preset[ 0 ] === babelPresetEnv ) {
return [ babelPresetEnv, Object.assign(
{},
preset[ 1 ],
{ modules: 'commonjs' }
) ];
}
return preset;
} ),
},
module: {
...babelDefaultConfig,
babelrc: false,
plugins,
},
main: Object.assign(
{},
babelDefaultConfig,
{
babelrc: false,
plugins,
presets: map( babelDefaultConfig.presets, ( preset ) => {
if ( isArray( preset ) && preset[ 0 ] === babelPresetEnv ) {
return [ babelPresetEnv, Object.assign(
{},
preset[ 1 ],
{ modules: 'commonjs' }
) ];
}
return preset;
} ),
}
),
module: Object.assign(
{},
babelDefaultConfig,
{
babelrc: false,
plugins,
}
),
};

function getBabelConfig( environment ) {
Expand Down

0 comments on commit 6c8ab9b

Please sign in to comment.