Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build Tooling: Avoid using spread for objects to work with all node 8x versions #7043

Merged
merged 1 commit into from
May 31, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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