Skip to content

Commit e98cfde

Browse files
committed
fix: 'new-vue-to-create-app' fails to convert 'new vue () 'with no arguments
1 parent 61cae70 commit e98cfde

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

transformations/__tests__/new-vue-to-create-app.spec.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,14 @@ defineInlineTest(
99
'transform `new Vue()` to createApp()'
1010
)
1111

12+
defineInlineTest(
13+
transform,
14+
{},
15+
`new Vue()`,
16+
`Vue.createApp()`,
17+
'transform `new Vue()` to createApp() with no arguments'
18+
)
19+
1220
defineInlineTest(
1321
transform,
1422
{},

transformations/new-vue-to-create-app.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,10 @@ export const transformAST: ASTTransformation<Params | void> = (
3131

3232
// new Vue() -> Vue.createApp()
3333
newVue.replaceWith(({ node }) => {
34-
const rootProps = node.arguments[0]
34+
const rootProps = node.arguments
3535
return j.callExpression(
3636
j.memberExpression(j.identifier('Vue'), j.identifier('createApp')),
37-
[rootProps]
37+
rootProps
3838
)
3939
})
4040

0 commit comments

Comments
 (0)