Registry / web-framework / babel-preset-cgb

babel-preset-cgb

JSON →
library1.7.1jsnpmunverified

Babel preset for Create Guten Block (CGB), version 1.7.1, used to transpile modern JavaScript for WordPress Gutenberg block development. It configures Babel with plugins and presets optimized for WordPress plugin environments, including React JSX support and ES2015+ transforms. This preset is part of the CGB toolchain, which is now deprecated in favor of @wordpress/create-block. It simplifies Babel configuration for WordPress block development but is no longer actively maintained.

npm install babel-preset-cgb
INSTALL
IMPORT
SIG · BABEL-PRESET-CGB
B
babel-preset-cgb
web-frameworkjavascriptv1.7.1
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

default export
module.exports = require('babel-preset-cgb');
import preset from 'babel-preset-cgb';
CJS-only; package does not support ESM. Use require().
preset name in config
presets: ['cgb']
presets: ['babel-preset-cgb']
Short form 'cgb' works because Babel resolves prefixes. Full name also works.
preset options
presets: [['cgb', { modules: false }]]
presets: ['cgb', { modules: false }]
Options must be in an array format: [presetName, options].

Installs the preset and configures Babel to use it for transpiling a JavaScript file.

// Install npm install --save-dev @babel/core babel-preset-cgb // .babelrc or babel.config.js { "presets": ["cgb"] } // Example: Transpile a file using Babel CLI npx babel src/index.js --out-file dist/index.js
Debug
Known issues
deprecatedbabel-preset-cgb is deprecated in favor of @wordpress/create-block and @wordpress/babel-preset-default.
fix
Migrate to @wordpress/create-block for Gutenberg block development and use @wordpress/babel-preset-default as the Babel preset.
affects: >=1.0.0
gotchaPackage does not support ES modules (ESM); only CommonJS require() works.
fix
Use 'const preset = require("babel-preset-cgb")' in Node.js/Babel config files.
affects: >=1.0.0
gotchaShort preset name 'cgb' may conflict with other presets. Always use full name 'babel-preset-cgb' in config to avoid ambiguity.
fix
Set 'presets: ["babel-preset-cgb"]' in your Babel configuration.
affects: >=1.0.0
Errors
Common errors & fixes
Error: Cannot find module 'babel-preset-cgb'
Missing local install or wrong working directory.
fix
Run 'npm install --save-dev babel-preset-cgb @babel/core' in your project root.
Error: Plugin/Preset files are not allowed to export objects, only functions.
Using an outdated Babel version (<7) that does not support modern preset format.
fix
Upgrade to Babel 7 by installing '@babel/core' and '@babel/preset-env'.
Error: Requires Babel "^7.0.0", but was loaded with "6.x".
Babel 6 is installed while the preset requires Babel 7.
fix
Install '@babel/core' version 7.x using 'npm install --save-dev @babel/core'.
Upgrade
Version history
1.7.1latest on npm
Audit
Dependencies
@babel/corerequiredrequired peer dependency for Babel transformation
@babel/preset-reactrequiredadds React JSX support
@babel/preset-envrequiredtargets modern JavaScript features
Agent activity
12 hits · last 30 days
node
10
OpenAI (training)
1
Resources
babel-preset-cgb — npm install babel-preset-cgb · libregistry