We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 622e53b commit 0662d17Copy full SHA for 0662d17
transformations/__tests__/root-prop-to-use-test.ts
@@ -20,3 +20,12 @@ defineInlineTest(
20
`Vue.createApp({}).use(router);`,
21
'Can recognize Vue.createApp'
22
)
23
+
24
+defineInlineTest(
25
+ transform,
26
+ {
27
+ rootPropName: 'router',
28
+ },
29
+ `createApp({});`,
30
+ `createApp({});`
31
+)
transformations/root-prop-to-use.ts
@@ -42,6 +42,11 @@ export const transformAST: ASTTransformation<Params> = (
42
// @ts-ignore
43
(p) => p.key && p.key.name === rootPropName
44
45
46
+ if (propertyIndex === -1) {
47
+ return createAppCall
48
+ }
49
50
51
const [{ value: pluginInstance }] = rootProps.properties.splice(
52
propertyIndex,
0 commit comments