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

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

Contributors

The avatar of contributor named as zhiyuanzmj zhiyuanzmj
The avatar of contributor named as Kevin Deng Kevin Deng
The avatar of contributor named as gaokefei gaokefei

Changelog