mirror of
https://github.com/ezolenko/rollup-plugin-typescript2.git
synced 2025-12-08 19:06:16 +00:00
refactor: invert another if for readabilty -- in get-options (#348)
- my previous commit was mostly focused on index.ts, this one is for get-options-overrides -- in general, I'm just trying to make old code more readable as I come across and then realize that the code can be re-written better, or, in this case, a conditional inverted
This commit is contained in:
parent
4a0c2977f8
commit
d9fc987044
@ -20,20 +20,20 @@ export function getOptionsOverrides({ useTsconfigDeclarationDir, cacheRoot }: IO
|
||||
allowNonTsExtensions: true,
|
||||
};
|
||||
|
||||
if (preParsedTsconfig)
|
||||
{
|
||||
if (preParsedTsconfig.options.module === undefined)
|
||||
overrides.module = tsModule.ModuleKind.ES2015;
|
||||
if (!preParsedTsconfig)
|
||||
return overrides;
|
||||
|
||||
// only set declarationDir if useTsconfigDeclarationDir is enabled
|
||||
if (!useTsconfigDeclarationDir)
|
||||
overrides.declarationDir = undefined;
|
||||
if (preParsedTsconfig.options.module === undefined)
|
||||
overrides.module = tsModule.ModuleKind.ES2015;
|
||||
|
||||
// unsetting sourceRoot if sourceMap is not enabled (in case original tsconfig had inlineSourceMap set that is being unset and would cause TS5051)
|
||||
const sourceMap = preParsedTsconfig.options.sourceMap;
|
||||
if (!sourceMap)
|
||||
overrides.sourceRoot = undefined;
|
||||
}
|
||||
// only set declarationDir if useTsconfigDeclarationDir is enabled
|
||||
if (!useTsconfigDeclarationDir)
|
||||
overrides.declarationDir = undefined;
|
||||
|
||||
// unsetting sourceRoot if sourceMap is not enabled (in case original tsconfig had inlineSourceMap set that is being unset and would cause TS5051)
|
||||
const sourceMap = preParsedTsconfig.options.sourceMap;
|
||||
if (!sourceMap)
|
||||
overrides.sourceRoot = undefined;
|
||||
|
||||
return overrides;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user