Pob Babel
raw JSON → 45.0.1 verified Sat Apr 25 auth: no javascript
Pob Babel is a build and watch tool using Babel and TypeScript, part of the Pob monorepo toolchain. The current stable version is 45.0.1, requiring Node.js >=22.18.0. It integrates Babel compilation with TypeScript type-checking, providing a streamlined development workflow for JavaScript and TypeScript projects. Key differentiators include automatic dependency handling, watch mode, and integration with other Pob tools like @pob/version and pob-dependencies.
Common errors
error Error: Cannot find module 'pob-babel' ↓
cause Package not installed or import path incorrect
fix
Run 'npm install pob-babel' and use correct import: import pobBabel from 'pob-babel'
error TypeError: pobBabel.build is not a function ↓
cause Using default import but trying to call build as a method
fix
Use named import: import { build } from 'pob-babel'
error Error: Requires Node.js 22.18.0 or higher ↓
cause Node.js version too old
fix
Upgrade Node.js to version >=22.18.0
error SyntaxError: Cannot use import statement outside a module ↓
cause Using ESM import in a CommonJS project without proper configuration
fix
Add 'type': 'module' to package.json or use .mjs extension
Warnings
breaking Node.js >=22.18.0 required as of version 45.0.0 ↓
fix Upgrade Node.js to version 22.18.0 or later
breaking ESM-only: CommonJS require() not supported since v45 ↓
fix Use import syntax or dynamic import()
deprecated The 'watch' callback API deprecated in favor of event emitter ↓
fix Use watcher.on('change', cb) instead of passing callback to watch()
gotcha TypeScript config must be in tsconfig.json, not in Babel config ↓
fix Place TypeScript options in tsconfig.json; Babel only handles transpilation
breaking Removed support for .babelrc; use babel.config.js instead ↓
fix Migrate to babel.config.js or babel.config.cjs
Install
npm install pob-babel yarn add pob-babel pnpm add pob-babel Imports
- pob-babel wrong
const pobBabel = require('pob-babel')correctimport pobBabel from 'pob-babel' - build wrong
const build = require('pob-babel/build')correctimport { build } from 'pob-babel' - watch wrong
const watch = require('pob-babel').watchcorrectimport { watch } from 'pob-babel'
Quickstart
import { build, watch } from 'pob-babel';
// Build once
await build({
cwd: process.cwd(),
config: './babel.config.js',
typescript: true,
clean: true
});
// Watch mode
const watcher = watch({
cwd: process.cwd(),
config: './babel.config.js',
typescript: true
});
watcher.on('change', (file) => console.log(`File changed: ${file}`));
watcher.start();