Skip to content

Commit 33ae281

Browse files
committed
fix: do not blindless remove Vue.use statements
Fixes #28 Note: the end result is still not valid Vue 3 code. But at least it doesn't introduce unintended changes.
1 parent bbe310c commit 33ae281

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

Diff for: generator/codemods/global-api/remove-vue-use.js

+14-1
Original file line numberDiff line numberDiff line change
@@ -22,5 +22,18 @@ module.exports = function removeVueUse({ j, root }) {
2222
}
2323
}
2424
})
25-
vueUseCalls.remove()
25+
26+
const removablePlugins = ['VueRouter', 'Vuex']
27+
const removableUseCalls = vueUseCalls.filter(({ node }) => {
28+
if (j.Identifier.check(node.arguments[0])) {
29+
const plugin = node.arguments[0].name
30+
if (removablePlugins.includes(plugin)) {
31+
return true
32+
}
33+
}
34+
35+
return false
36+
})
37+
38+
removableUseCalls.remove()
2639
}

0 commit comments

Comments
 (0)