fix(build): fixed duplicate import identifiers

This commit is contained in:
Justin Cuaresma 2019-02-01 23:09:50 -05:00
parent 92140cd2db
commit 3aedde55d8

View File

@ -37,10 +37,15 @@ function transformImports(file: ts.SourceFile, ctx: ts.TransformationContext, ng
decorators.forEach(d => methods = getMethodsForDecorator(d).concat(methods)); decorators.forEach(d => methods = getMethodsForDecorator(d).concat(methods));
const methodElements = methods.map(m => ts.createIdentifier(m));
const methodNames = methodElements.map((el) => el.escapedText);
importStatement.importClause.namedBindings.elements = [ importStatement.importClause.namedBindings.elements = [
ts.createIdentifier('IonicNativePlugin'), ts.createIdentifier('IonicNativePlugin'),
...methods.map(m => ts.createIdentifier(m)), ...methodElements,
...importStatement.importClause.namedBindings.elements.filter(el => keep.indexOf(el.name.text) !== -1) ...importStatement.importClause.namedBindings.elements.filter(
el => keep.indexOf(el.name.text) !== -1 && methodNames.indexOf(el.name.text) === -1
)
]; ];
if (ngcBuild) { if (ngcBuild) {