Subscribe on changes!

template compile will generate useless createVNode import when the component can be statically optimized

avatar
Dec 6th 2020

Version

3.0.4

Reproduction link

https://vue-next-template-explorer.netlify.app/#%7B%22src%22%3A%22%3Ctemplate%3E%5Cn%20%20%3Ctemplate%20v-if%3D%5C%22column.render%5C%22%3E%5Cn%20%20%20%20%3Crender%20%3Arender%3D%5C%22()%20%3D%3E%20column.render(row%2C%20index)%5C%22%20%2F%3E%5Cn%20%20%3C%2Ftemplate%3E%5Cn%20%20%3Ctemplate%20v-else%3E%5Cn%20%20%20%20%7B%7B%20row%5Bcolumn.key%5D%20%7D%7D%5Cn%20%20%3C%2Ftemplate%3E%5Cn%3C%2Ftemplate%3E%22%2C%22options%22%3A%7B%22mode%22%3A%22module%22%2C%22prefixIdentifiers%22%3Afalse%2C%22optimizeImports%22%3Afalse%2C%22hoistStatic%22%3Afalse%2C%22cacheHandlers%22%3Afalse%2C%22scopeId%22%3Anull%2C%22inline%22%3Afalse%2C%22ssrCssVars%22%3A%22%7B%20color%20%7D%22%2C%22bindingMetadata%22%3A%7B%22TestComponent%22%3A%22setup%22%2C%22foo%22%3A%22setup%22%2C%22bar%22%3A%22props%22%7D%7D%7D

Steps to reproduce

image

https://vue-next-template-explorer.netlify.app/#%7B%22src%22%3A%22%3Ctemplate%3E%5Cn%20%20%3Ctemplate%20v-if%3D%5C%22column.render%5C%22%3E%5Cn%20%20%20%20%3Crender%20%3Arender%3D%5C%22()%20%3D%3E%20column.render(row%2C%20index)%5C%22%20%2F%3E%5Cn%20%20%3C%2Ftemplate%3E%5Cn%20%20%3Ctemplate%20v-else%3E%5Cn%20%20%20%20%7B%7B%20row%5Bcolumn.key%5D%20%7D%7D%5Cn%20%20%3C%2Ftemplate%3E%5Cn%3C%2Ftemplate%3E%22%2C%22options%22%3A%7B%22mode%22%3A%22module%22%2C%22prefixIdentifiers%22%3Afalse%2C%22optimizeImports%22%3Afalse%2C%22hoistStatic%22%3Afalse%2C%22cacheHandlers%22%3Afalse%2C%22scopeId%22%3Anull%2C%22inline%22%3Afalse%2C%22ssrCssVars%22%3A%22%7B%20color%20%7D%22%2C%22bindingMetadata%22%3A%7B%22TestComponent%22%3A%22setup%22%2C%22foo%22%3A%22setup%22%2C%22bar%22%3A%22props%22%7D%7D%7D

What is expected?

createVNode shouldn't be imported

What is actually happening?

createVNode is imported