babel-plugin-zova-bean-module

raw JSON →
1.2.8 verified Sat Apr 25 auth: no javascript

A Babel plugin for the Zova framework that enables module-based bean resolution and injection. Current stable version is 1.2.8. Released as part of the Zova project, follows Zova's release cadence. Key differentiator: transforms module-scoped bean decorators/annotations into runtime injectable code, essential for Zova's IoC container. Unlike generic DI plugins, it understands Zova's module system and generates proper module references.

error Error: Cannot find module 'babel-plugin-zova-bean-module'
cause Plugin not installed or not in node_modules.
fix
Run npm install --save-dev babel-plugin-zova-bean-module and ensure it's listed in devDependencies.
error SyntaxError: This experimental syntax requires enabling one of the following parser plugin(s): "decorators", "decorators-legacy"
cause Babel parser is not configured to handle decorator syntax.
fix
Add '@babel/plugin-proposal-decorators' to your Babel plugins array: plugins: [['@babel/plugin-proposal-decorators', { version: '2023-05' }], 'babel-plugin-zova-bean-module']
error TypeError: (0 , _plugin.default) is not a function
cause Using ESM-style import of the plugin (e.g., import plugin from '...') which returns a module object, not the plugin function.
fix
Use CommonJS require: const plugin = require('babel-plugin-zova-bean-module'); or reference the string name in Babel config.
gotcha Plugin requires Zova framework context – transforms only work within Zova modules, not standalone.
fix Ensure your source files are part of a Zova module (e.g., have @Module decorator or equivalent).
breaking Starting from version 1.2.0, the plugin no longer supports legacy decorator syntax; ES decorator proposal syntax is required.
fix Migrate from @Bean() decorator (legacy) to @bean() (ES proposal) syntax.
npm install babel-plugin-zova-bean-module
yarn add babel-plugin-zova-bean-module
pnpm add babel-plugin-zova-bean-module

Shows how to install and configure the Babel plugin in a typical Node.js project using CommonJS.

// Install: npm install --save-dev babel-plugin-zova-bean-module
// Then in babel.config.js:
module.exports = {
  presets: [
    ['@babel/preset-env', { targets: { node: 'current' } }],
  ],
  plugins: ['babel-plugin-zova-bean-module'],
};