This Babel plugin, `babel-plugin-transform-vue-jsx`, provides JSX syntax support specifically for Vue.js 2.x applications when used with Babel 6. Its primary function is to transpile JSX elements within Vue components into `h` (createElement) function calls, enabling developers to write render functions using a more declarative, React-like syntax. The version 3.7.0, as specified, is part of the older branch designed for Babel 6. It is no longer actively maintained. For projects utilizing Babel 7 and Vue 2, the successor plugin `@vue/babel-plugin-transform-vue-jsx` (latest v1.4.0, published 4 years ago) should be used instead. For Vue 3 projects, `@vue/babel-plugin-jsx` (latest v2.0.1, published 5 months ago) is the recommended and actively maintained solution. This particular package (`babel-plugin-transform-vue-jsx` v3.7.0) does not follow a regular release cadence and is considered superseded for modern development environments.
npm install babel-plugin-transform-vue-jsxVerified import paths — ran on the pinned version, not inferred.
This .babelrc configuration enables JSX transformation for Vue 2 applications using Babel 6. It includes the necessary syntax plugin and the transform plugin.
For Babel 7 and Vue 2, use `@vue/babel-plugin-transform-vue-jsx`. For Vue 3, use `@vue/babel-plugin-jsx`.
Migrate to `@vue/babel-plugin-transform-vue-jsx` for Vue 2 + Babel 7, or `@vue/babel-plugin-jsx` for Vue 3 projects.
Use programmatic equivalents (ternary, .map()) for unsupported directives or pass directive data as objects for custom directives. Refer to the plugin's documentation for detailed workarounds.
Ensure `h` is in scope for render functions, especially with arrow functions or regular functions, by explicitly declaring it or passing it as a parameter.
Install `babel-plugin-syntax-jsx` explicitly: `npm install babel-plugin-syntax-jsx --save-dev` or `yarn add babel-plugin-syntax-jsx --dev`.
For render functions, ensure `render(h) { ... }` or `const h = this.$createElement;` is present. For methods/getters, check plugin version (3.4.0+ for auto-inject) and ensure they are ES2015 methods, not arrow functions or regular functions.