return function render() {
with (this) {
const _component_Foo = _resolveComponent(\\"Foo\\")
- const _component_barbaz = _resolveComponent(\\"bar-baz\\")
+ const _component_bar_baz = _resolveComponent(\\"bar-baz\\")
+ const _component_barbaz = _resolveComponent(\\"barbaz\\")
const _directive_my_dir = _resolveDirective(\\"my_dir\\")
return null
test('assets', () => {
const root = createRoot({
- components: [`Foo`, `bar-baz`],
+ components: [`Foo`, `bar-baz`, `barbaz`],
directives: [`my_dir`]
})
const { code } = generate(root, { mode: 'function' })
`const _component_Foo = _${helperNameMap[RESOLVE_COMPONENT]}("Foo")\n`
)
expect(code).toMatch(
- `const _component_barbaz = _${
+ `const _component_bar_baz = _${
helperNameMap[RESOLVE_COMPONENT]
}("bar-baz")\n`
)
+ expect(code).toMatch(
+ `const _component_barbaz = _${
+ helperNameMap[RESOLVE_COMPONENT]
+ }("barbaz")\n`
+ )
expect(code).toMatch(
`const _directive_my_dir = _${
helperNameMap[RESOLVE_DIRECTIVE]
name: string,
type: 'component' | 'directive'
): string {
- return `_${type}_${name.replace(/[^\w]/g, '')}`
+ return `_${type}_${name.replace(/[^\w]/g, '_')}`
}
export function isEmptyExpression(node: ExpressionNode) {