File tree Expand file tree Collapse file tree 1 file changed +23
-16
lines changed Expand file tree Collapse file tree 1 file changed +23
-16
lines changed Original file line number Diff line number Diff line change @@ -35,22 +35,29 @@ export const transformAST: ASTTransformation = context => {
35
35
const createRouterIdentifiers = root . find ( j . Identifier , {
36
36
name : 'createRouter'
37
37
} )
38
- if ( createRouterIdentifiers . length ) {
39
- // rename createRouter to newCreateRouter
40
- localCreateRouter = 'newCreateRouter'
41
- addImport ( context , {
42
- specifier : {
43
- type : 'named' ,
44
- imported : 'createRouter' ,
45
- local : localCreateRouter
46
- } ,
47
- source : 'vue-router'
48
- } )
49
- } else {
50
- addImport ( context , {
51
- specifier : { type : 'named' , imported : 'createRouter' } ,
52
- source : 'vue-router'
53
- } )
38
+ const importedCreateRouter = importedVueRouter . find ( j . ImportSpecifier , {
39
+ imported : {
40
+ name : 'createRouter'
41
+ }
42
+ } )
43
+ if ( ! importedCreateRouter . length ) {
44
+ if ( createRouterIdentifiers . length ) {
45
+ // rename createRouter to newCreateRouter
46
+ localCreateRouter = 'newCreateRouter'
47
+ addImport ( context , {
48
+ specifier : {
49
+ type : 'named' ,
50
+ imported : 'createRouter' ,
51
+ local : localCreateRouter
52
+ } ,
53
+ source : 'vue-router'
54
+ } )
55
+ } else {
56
+ addImport ( context , {
57
+ specifier : { type : 'named' , imported : 'createRouter' } ,
58
+ source : 'vue-router'
59
+ } )
60
+ }
54
61
}
55
62
56
63
// filter the node to the manual list
You can’t perform that action at this time.
0 commit comments