Skip to content

Commit 8804cbb

Browse files
committed
attempt at fix. partial
1 parent abfd9d6 commit 8804cbb

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/utils/macros.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ module.exports = class Macros {
3434
collectDebugToolsSpecifiers(specifiers) {
3535
specifiers.forEach(specifier => {
3636
if (specifier.node.imported && SUPPORTED_MACROS.indexOf(specifier.node.imported.name) > -1) {
37-
this.localDebugBindings.push(specifier.get('local'));
37+
this.localDebugBindings.push(specifier);
3838
}
3939
});
4040
}
@@ -47,7 +47,7 @@ module.exports = class Macros {
4747

4848
if (
4949
this.builder.t.isCallExpression(expression) &&
50-
this.localDebugBindings.some(b => b.node.name === expression.callee.name)
50+
this.localDebugBindings.some(b => b.get('imported').node.name === expression.callee.name)
5151
) {
5252
let imported = path.scope.getBinding(expression.callee.name).path.node.imported.name;
5353
this.builder[`${imported}`](path);
@@ -65,9 +65,11 @@ module.exports = class Macros {
6565
let specifiers = importPath.get('specifiers');
6666

6767
if (specifiers.length === this.localDebugBindings.length) {
68-
this.localDebugBindings[0].parentPath.parentPath.remove();
68+
importPath.remove();
69+
} else if (specifiers.length === 1) {
70+
importPath.remove();
6971
} else {
70-
this.localDebugBindings.forEach(binding => binding.parentPath.remove());
72+
this.localDebugBindings.forEach(binding => binding.get('local').parentPath.remove());
7173
}
7274
}
7375
}

0 commit comments

Comments
 (0)