babel-plugin-zova-behavior
raw JSON → 1.1.8 verified Sat Apr 25 auth: no javascript
A Babel plugin for the Zova framework that enhances class-based component behavior with decorators and runtime metadata. Version 1.1.8 supports Babel 7.x and uses modern JavaScript transformation patterns. Key differentiator: provides seamless integration with Zova's behavior system for DI and lifecycle management. No known alternatives.
Common errors
error Error: Cannot find module 'babel-plugin-zova-behavior' ↓
cause Package not installed or not in node_modules.
fix
Run npm install babel-plugin-zova-behavior --save-dev
error TypeError: this[Symbol.for('zova:behavior')] is not a function ↓
cause Decorator applied to unsupported class type.
fix
Ensure decorator is only applied to classes extending predefined Zova base classes
Warnings
breaking Babel 6 is not supported. Plugin uses Babel 7 API. ↓
fix Upgrade to Babel 7 and plugin version >=1.1.0
deprecated Decorator syntax is Stage 2 proposal, may change in future ECMAScript spec. ↓
fix Consider using TC39 decorators when stable
gotcha Plugin must be before other decorator plugins in plugin list. ↓
fix Place 'babel-plugin-zova-behavior' before other decorator plugins in Babel config
Install
npm install babel-plugin-zova-behavior yarn add babel-plugin-zova-behavior pnpm add babel-plugin-zova-behavior Imports
- default wrong
const babelPluginZovaBehavior = require('babel-plugin-zova-behavior')correctimport babelPluginZovaBehavior from 'babel-plugin-zova-behavior' - babelPluginZovaBehavior wrong
import babelPluginZovaBehavior from 'babel-plugin-zova-behavior'correctimport { babelPluginZovaBehavior } from 'babel-plugin-zova-behavior' - default (in babel.config.js) wrong
module.exports = { plugins: ['zova-behavior'] }correctmodule.exports = { plugins: ['babel-plugin-zova-behavior'] }
Quickstart
// babel.config.js
module.exports = {
plugins: ['babel-plugin-zova-behavior']
};
// In your source file
import { Behavior } from 'zova';
@Behavior()
export class MyBehavior {
created() {
console.log('Behavior created');
}
}