Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions e2e/__projects__/basic/components/FunctionalRenderFn.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<script>
import { h } from 'vue'

export default () =>
h(
'div',
{
id: 'functional-render-fn'
},
'Nyan'
)
</script>
9 changes: 9 additions & 0 deletions e2e/__projects__/basic/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import NoScript from './components/NoScript.vue'
import PugRelative from './components/PugRelativeExtends.vue'
import { randomExport } from './components/NamedExport.vue'
import ScriptSetup from './components/ScriptSetup.vue'
import FunctionalRenderFn from './components/FunctionalRenderFn.vue'

// TODO: JSX for Vue 3? TSX?
import Jsx from './components/Jsx.vue'
Expand Down Expand Up @@ -179,3 +180,11 @@ xtest('processes .vue file using jsx', () => {
mount(Jsx)
expect(document.querySelector('#jsx')).toBeTruthy()
})

test('processes functional component exported as function', () => {
mount(FunctionalRenderFn)

const elem = document.querySelector('#functional-render-fn')
expect(elem).toBeTruthy()
expect(elem.innerHTML).toBe('Nyan')
})
2 changes: 1 addition & 1 deletion lib/generate-code.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ module.exports = function generateCode(
if (tempOutput.includes('exports.render = render;')) {
node.add(';exports.default = {...exports.default, render};')
} else {
node.add(';exports.default = {...exports.default};')
// node.add(';exports.default = {...exports.default};')
}

return node.toStringWithSourceMap({ file: filename })
Expand Down