A CommonJS-compatible Babel plugin for esbuild. Current stable version 1.0.0. This plugin allows you to apply Babel transformations within esbuild bundles when esbuild's native transform capabilities are insufficient. Unlike alternatives (e.g., esbuild-plugin-babel or @aspect-build/esbuild), this package explicitly targets CommonJS environments and provides a simple, minimal API. It requires @babel/core as a peer dependency and delegates Babel configuration to babel.config.json or inline config. Suitable for legacy projects or those locked into CJS.
npm install esbuild-plugin-babel-cjsNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Minimal esbuild config that applies Babel transformations via the plugin. Ensure @babel/core is installed and Babel configuration is set separately.
Create a babel.config.json or pass config object to babel({ config: { presets: [...], plugins: [...] } }).Add target: ['es5'] to esbuild.build options.
Replace require('esbuild-plugin-babel') with require('esbuild-plugin-babel-cjs').Consider using esbuild's own transforms when possible for performance.
Pass babel({ namespace: 'babel' }) to avoid conflicts.Run 'npm install @babel/core --save-dev' or add it to devDependencies.
Use default import: import babel from 'esbuild-plugin-babel-cjs' or require('esbuild-plugin-babel-cjs').Create a babel.config.json in the project root or pass config option to babel().
Use import syntax: import babel from 'esbuild-plugin-babel-cjs';