babel-pundle
raw JSON → 1.1.12 verified Sat Apr 25 auth: no javascript deprecated
Babel transformer plugin for Pundle, a JavaScript bundler. Version 1.1.12 is the latest stable release, with v2.0.0-alpha1 introducing breaking architectural changes. This plugin enables Babel transformations within Pundle's build pipeline, supporting custom Babel configuration, file extension filtering, and ignore patterns. Key differentiators: integrates deeply with Pundle's plugin system, but is deprecated in favor of Pundle's built-in Babel support in v2. No active maintenance since 2017.
Common errors
error Error: Cannot find module 'babel-pundle' ↓
cause Missing npm install or wrong require path
fix
Run 'npm install babel-pundle --save' and use require.resolve('babel-pundle')
error TypeError: plugin is not a function ↓
cause Incorrect plugin syntax; must be an array with path and options
fix
Wrap in array: [require.resolve('babel-pundle'), { config: {} }]
error SyntaxError: Unexpected token import ↓
cause Babel not configured to transpile ES modules
fix
Add '@babel/preset-env' to config.presets
Warnings
deprecated babel-pundle is deprecated in favor of Pundle's built-in Babel support in v2+ ↓
fix Upgrade to Pundle v2 and use built-in Babel configuration via Pundleconfig.js
breaking Breaking change: v2.0.0-alpha1 changes plugin API; v1.x plugins are incompatible ↓
fix Do not upgrade to v2 alpha unless you can adapt to new component/preset architecture
gotcha Common mistake: using plugin name string instead of require.resolve() path ↓
fix Use require.resolve('babel-pundle') to get the absolute path
gotcha Configuration key is 'config', not 'babel' or 'options' ↓
fix Pass Babel config under the 'config' property in plugin options
Install
npm install babel-pundle yarn add babel-pundle pnpm add babel-pundle Imports
- default export wrong
const babelPundle = require('babel-pundle')correctimport babelPundle from 'babel-pundle' - plugin usage wrong
pundle.loadPlugins([['babel-pundle', { ignore: ... }]])correctpundle.loadPlugins([[require.resolve('babel-pundle'), { config: { ... } }]]) - type import
import type { PluginOptions } from 'babel-pundle'
Quickstart
const pundle = require('pundle');
pundle.loadPlugins([
[require.resolve('babel-pundle'), {
ignored: /node_modules/,
extensions: ['.js', '.jsx'],
config: {
presets: ['@babel/preset-env']
}
}]
]).then(() => console.log('Plugin loaded'));
pundle.bundle('./src/index.js').then(result => {
console.log(result.code);
});