mirror of
https://github.com/danielsogl/awesome-cordova-plugins.git
synced 2025-03-17 00:51:07 +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));
|
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) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user