fix(build): fixed duplicate import identifiers (#2914)

This commit is contained in:
Daniel Sogl 2019-02-14 09:41:26 +01:00 committed by GitHub
commit bceb428690
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -37,10 +37,15 @@ function transformImports(file: ts.SourceFile, ctx: ts.TransformationContext, ng
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 = [
ts.createIdentifier('IonicNativePlugin'),
...methods.map(m => ts.createIdentifier(m)),
...importStatement.importClause.namedBindings.elements.filter(el => keep.indexOf(el.name.text) !== -1)
...methodElements,
...importStatement.importClause.namedBindings.elements.filter(
el => keep.indexOf(el.name.text) !== -1 && methodNames.indexOf(el.name.text) === -1
)
];
if (ngcBuild) {