Subscribe on changes!

`script setup` with extra `render` function does not render anything in production mode, but works in dev mode.

avatar
Nov 21st 2021

Version

3.2.22

Reproduction link

sfc.vuejs.org/

Steps to reproduce

<script setup>
import { ref } from 'vue'

const msg = ref('Hello World!')

defineExpose({msg})
</script>

<script>
import { h } from 'vue';

export default {
  render () {
    return h('div', {}, 'hello ' + this.msg)
  }
}
</script>

What is expected?

It should render hello Hello World! after build.

What is actually happening?

No error is reported, but It renders nothing after build. BUT renders hello Hello World! in dev mode (you may use the download button on sfc playground and try it).

avatar
Nov 21st 2021

The fact that it works is a unwanted side-effect of a difference in the dev-behaviour required for debuggability / HMR.

We should find some way to warn about this though - the first thing coming to mind would be to throw an error for SFCs using script setup that don't use a