Skip to content

Commit

Permalink
chore: rename variables to prevent shadowing
Browse files Browse the repository at this point in the history
  • Loading branch information
sastan committed Nov 14, 2019
1 parent c077d93 commit 24bc8f5
Showing 1 changed file with 11 additions and 10 deletions.
21 changes: 11 additions & 10 deletions src/util/get-babel-config/get-babel-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ export function getBabelConfig({

if (noBabelConfigCustomization === true) {
const loadOptionsForFilename = (filename: string, useChunkOptions: boolean = false) => {
const partialConfig =
const partialCustomConfig =
resolvedConfig != null && resolvedConfig.kind === "dict"
? // If the given babelConfig is an object of input options, use that as the basis for the full config
resolvedConfig
Expand All @@ -146,28 +146,29 @@ export function getBabelConfig({

// fully load all options, which results in a flat plugins structure
// which can then be used to match chunk plugins
const options = loadOptions({
...partialConfig.options,
const fullOptions = loadOptions({
...partialCustomConfig.options,
...forcedOptions,
presets: partialConfig.options.presets,
plugins: partialConfig.options.plugins,
presets: partialCustomConfig.options.presets,
plugins: partialCustomConfig.options.plugins,
filename,
caller: {
name: "rollup-plugin-ts",
...(partialConfig.options.caller || {}),
...(partialCustomConfig.options.caller ? partialCustomConfig.options.caller : {}),
supportsStaticESM: true,
supportsDynamicImport: true
}
});

// sourceMap is an alias for 'sourceMaps'. If the user provided it, make sure it is undefined. Otherwise, Babel will fail during validation
if ("sourceMap" in options) {
delete options.sourceMap;
if ("sourceMap" in fullOptions) {
delete fullOptions.sourceMap;
}

return {
...options,
plugins: combineConfigItems(options.plugins, [], [], useChunkOptions)
...fullOptions,
// presets is an empty array as babel as resolved all plugins
plugins: combineConfigItems(fullOptions.plugins, [], [], useChunkOptions)
};
};

Expand Down

0 comments on commit 24bc8f5

Please sign in to comment.