From 25d2f59018d395c4bb65ef1b28fcf6a8b83bbd14 Mon Sep 17 00:00:00 2001 From: Logan Smyth Date: Thu, 16 Aug 2018 17:35:23 -0700 Subject: [PATCH] Ensure that presets properly flatten their options. --- packages/babel-core/src/config/config-chain.js | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/packages/babel-core/src/config/config-chain.js b/packages/babel-core/src/config/config-chain.js index e81ca81f74..ee48361708 100644 --- a/packages/babel-core/src/config/config-chain.js +++ b/packages/babel-core/src/config/config-chain.js @@ -55,7 +55,21 @@ export type ConfigContext = { /** * Build a config chain for a given preset. */ -export const buildPresetChain: ( +export function buildPresetChain( + arg: PresetInstance, + context: *, +): ConfigChain | null { + const chain = buildPresetChainWalker(arg, context); + if (!chain) return null; + + return { + plugins: dedupDescriptors(chain.plugins), + presets: dedupDescriptors(chain.presets), + options: chain.options, + }; +} + +export const buildPresetChainWalker: ( arg: PresetInstance, context: *, ) => * = makeChainWalker({