Skip to content

exportRender NPM Version

Stability: experimental ⚠️ Experimental feature, use at your risk

Transform the default export statement, in <script setup> of Vue SFC, as a component render function.

FeaturesSupported
Vue 3
Nuxt 3
Vue 2
Volar Plugin

TIP

This feature depends on defineRender, and make sure defineRender is not disabled.

Usage

vue
<script setup lang="tsx">
// JSX passed directly
export default <div>ok</div>

// Or using render function
export default () => <div>ok</div>
</script>

Volar Configuration

tsconfig.json
jsonc
{
  "vueCompilerOptions": {
    "plugins": ["unplugin-vue-macros/volar"],
    "vueMacros": {
      "exportRender": true,
    },
  },
}

Contributors

Changelog