Skip to content

Commit d02aa1e

Browse files
authored
fix: fixes #6 (vuejs#23)
1 parent a1f49ba commit d02aa1e

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

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

+11
Original file line numberDiff line numberDiff line change
@@ -72,3 +72,14 @@ defineInlineTest(
7272
`Vue.createApp(MyComponent).mount("#app")`,
7373
'transform `new MyComponent` with `el` prop'
7474
)
75+
76+
77+
78+
defineInlineTest(
79+
transform,
80+
{},
81+
`const container = new LazyContainer({ el, binding, vnode, lazy: this.lazy })`,
82+
`const container = new LazyContainer({ el, binding, vnode, lazy: this.lazy })`,
83+
'transform `new MyComponent` with `el` prop'
84+
)
85+

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

+5-1
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,11 @@ export const transformAST: ASTTransformation<Params | void> = (
142142
prop =>
143143
j.ObjectProperty.check(prop) &&
144144
j.Identifier.check(prop.key) &&
145-
prop.key.name === 'el'
145+
prop.key.name === 'el' &&
146+
// @ts-ignore
147+
prop.key.start !== prop.value.start &&
148+
// @ts-ignore
149+
prop.key.end !== prop.value.end
146150
)
147151
)
148152
})

0 commit comments

Comments
 (0)