babel-plugin-riza
raw JSON → 2.1.2 verified Fri May 01 auth: no javascript
A Babel plugin for transpiling JSX syntax in Riza applications. Version 2.1.2 is the current stable release. It provides JSX compilation specifically tailored for the Riza framework, with support for server components and client components. Key differentiators include optimized output for Riza's virtual DOM and built-in support for automatic runtime detection.
Common errors
error Error: Requires Babel 7 or higher ↓
cause Plugin is incompatible with Babel 6 or lower.
fix
Upgrade to Babel 7 or later.
error Error: Cannot find module 'babel-plugin-riza' ↓
cause Package not installed or not in node_modules.
fix
Run npm install babel-plugin-riza@latest
error TypeError: rizaPlugin is not a function ↓
cause Incorrect import style; plugin is CommonJS with default export.
fix
Use require('babel-plugin-riza') or module.exports = require('babel-plugin-riza') in config.
Warnings
breaking Plugin options have changed between versions 1.x and 2.x. The 'runtime' option was renamed to 'target'. ↓
fix Use 'target' instead of 'runtime' in plugin options.
breaking Version 2.x no longer supports the 'classic' runtime. Only 'automatic' runtime is supported. ↓
fix Remove runtime option or set to 'automatic'. Use React 17+ style JSX transform.
deprecated The option 'throwIfNamespace' is deprecated and will be removed in version 3.x. ↓
fix Set namespace validation via Babel's @babel/plugin-transform-react-jsx instead.
gotcha Plugin must be listed before other JSX plugins to work correctly. ↓
fix Ensure 'babel-plugin-riza' is the first in the plugins array.
Install
npm install babel-plugin-riza yarn add babel-plugin-riza pnpm add babel-plugin-riza Imports
- default wrong
import rizaPlugin from 'babel-plugin-riza'correctconst rizaPlugin = require('babel-plugin-riza') - rizaPlugin wrong
const { rizaPlugin } = require('babel-plugin-riza')correctconst rizaPlugin = require('babel-plugin-riza').default || require('babel-plugin-riza') - type PluginOptions wrong
const { PluginOptions } = require('babel-plugin-riza')correctimport type { PluginOptions } from 'babel-plugin-riza'
Quickstart
// .babelrc
{
"plugins": [
[
"babel-plugin-riza",
{
"target": "server",
"throwIfNamespace": false
}
]
]
}
// or programmatically
const babel = require('@babel/core');
babel.transformSync(code, {
plugins: [
['babel-plugin-riza', { target: 'client' }]
]
});