mirror of
https://github.com/danielsogl/awesome-cordova-plugins.git
synced 2025-01-19 16:52:53 +08:00
fix(build): fixed duplicate import identifiers (#2914)
This commit is contained in:
commit
bceb428690
@ -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) {
|
||||
|
Loading…
Reference in New Issue
Block a user