chore(build): fix v5 imports (#2465)

This commit is contained in:
Nicolas HENRY 2018-04-19 19:52:26 +02:00 committed by Ibby Hadeed
parent 0dfbb386ff
commit 88fda657f4

View File

@ -19,7 +19,9 @@ function transformImports(file: ts.SourceFile, ctx: ts.TransformationContext, ng
const decoratorRegex: RegExp = /@([a-zA-Z]+)\(/g;
const ignored: string [] = ['Plugin', 'Component'];
const ignored: string [] = ['Plugin', 'Component', 'Injectable'];
const keep: string [] = ['getPromise'];
let m;
@ -37,15 +39,18 @@ function transformImports(file: ts.SourceFile, ctx: ts.TransformationContext, ng
importStatement.importClause.namedBindings.elements = [
ts.createIdentifier('IonicNativePlugin'),
...methods.map(m => ts.createIdentifier(m))
...methods.map(m => ts.createIdentifier(m)),
...importStatement.importClause.namedBindings.elements.filter(el => keep.indexOf(el.name.text) !== -1)
];
if (ngcBuild) {
importStatement.importClause.namedBindings.elements = importStatement.importClause.namedBindings.elements.map(
binding => {
binding.name = {
text: binding.escapedText
};
if (binding.escapedText) {
binding.name = {
text: binding.escapedText
};
}
return binding;
}
);