File tree Expand file tree Collapse file tree 1 file changed +6
-4
lines changed Expand file tree Collapse file tree 1 file changed +6
-4
lines changed Original file line number Diff line number Diff line change @@ -34,7 +34,7 @@ module.exports = class Macros {
34
34
collectDebugToolsSpecifiers ( specifiers ) {
35
35
specifiers . forEach ( specifier => {
36
36
if ( specifier . node . imported && SUPPORTED_MACROS . indexOf ( specifier . node . imported . name ) > - 1 ) {
37
- this . localDebugBindings . push ( specifier . get ( 'local' ) ) ;
37
+ this . localDebugBindings . push ( specifier ) ;
38
38
}
39
39
} ) ;
40
40
}
@@ -47,7 +47,7 @@ module.exports = class Macros {
47
47
48
48
if (
49
49
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 )
51
51
) {
52
52
let imported = path . scope . getBinding ( expression . callee . name ) . path . node . imported . name ;
53
53
this . builder [ `${ imported } ` ] ( path ) ;
@@ -65,9 +65,11 @@ module.exports = class Macros {
65
65
let specifiers = importPath . get ( 'specifiers' ) ;
66
66
67
67
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 ( ) ;
69
71
} else {
70
- this . localDebugBindings . forEach ( binding => binding . parentPath . remove ( ) ) ;
72
+ this . localDebugBindings . forEach ( binding => binding . get ( 'local' ) . parentPath . remove ( ) ) ;
71
73
}
72
74
}
73
75
}
You can’t perform that action at this time.
0 commit comments