babel-plugin-jsx-vue-functional is a Babel plugin designed to simplify the creation of Vue.js functional components using JSX syntax. It automatically transforms arrow functions containing JSX into Vue functional component definitions, making it easier to write lightweight, render-only components. The current stable version is 2.1.0. This plugin primarily acts as syntactic sugar, working in conjunction with `@vue/babel-plugin-jsx` (or `transform-vue-jsx`) to enable a more concise way of declaring functional components within a Vue JSX setup. It differentiates itself by explicitly handling the transformation of named arrow functions into `functional: true` component objects, which is particularly useful for performance optimizations and simpler component structures in Vue applications. While its release cadence isn't frequent, updates typically address compatibility or add developer tooling enhancements.
npm install babel-plugin-jsx-vue-functionalVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to configure babel-plugin-jsx-vue-functional in your Babel setup and write a simple Vue functional component using the enhanced JSX syntax provided by the plugin.
If a named arrow function contains JSX, use it as a component tag (e.g., `<MyComponent />`) instead of calling it as a function (e.g., `{MyComponent()}`). If you intend for a function to be called directly and contain JSX, it must *not* be a named arrow function or must be explicitly excluded if the plugin had such an option (which it does not).Ensure `@vue/babel-plugin-jsx` is installed (`npm i -D @vue/babel-plugin-jsx`) and listed in your Babel configuration's `plugins` array, ideally *after* `jsx-vue-functional` for proper transformation order.
No fix needed; this is an enhancement for developer experience and only affects development builds.
Treat the function as a component and use it as a JSX tag (e.g., `<A />`) instead of calling it as a function. This applies since version 2.0.0.
Ensure both `jsx-vue-functional` and `@vue/babel-plugin-jsx` (or `transform-vue-jsx`) are installed and correctly listed in the `plugins` array of your Babel configuration. The order `jsx-vue-functional` then `@vue/babel-plugin-jsx` is generally recommended.