Babel preset for Taro projects, enabling JSX compilation for React, Vue, Solid, and Prefresh frameworks. Current stable version is 4.2.0, released on 2025-04-01. Release cadence: irregular, with frequent patch releases. Key differentiator: supports cross-platform app development (WeChat, Alipay, Baidu, HarmonyOS, H5, RN) by automatically configuring Babel plugins based on the target framework. Requires Node >= 18. Part of the NervJS/Taro monorepo. Alternatives: manual Babel config with individual presets.
npm install babel-preset-taroVerified import paths — ran on the pinned version, not inferred.
Configures Babel for a Taro React project with TypeScript support and automatic JSX runtime.
Upgrade Node.js to version 18 or higher.
Use framework: 'react' or 'vue' and configure Vite via @tarojs/plugin-vite-devtools.
Install @vue/babel-plugin-jsx@^1.2.2 for Vue 3.
Remove any manual JSX presets and rely on babel-preset-taro's framework selection.
Install @tarojs/taro-rn@4.2.0 as a devDependency.
Run npm install @babel/core --save-dev
Use framework: 'vue', or if using Vue, install @vue/babel-plugin-jsx
Change babel.config.js to use module.exports = { presets: [...] } instead of export default.