Registry / devops / babel-preset-cf

babel-preset-cf

JSON →
library2.0.0jsnpmunverified

A Babel preset for Cloudflare Workers and Pages projects. Current stable version is 2.0.0. This preset configures Babel transforms optimized for the Cloudflare runtime environment, including compatibility with Cloudflare's specific JavaScript engine features and limitations. It simplifies setup by bundling necessary plugins and presets, reducing configuration overhead for Cloudflare-targeted JavaScript code. Released infrequently; relies on underlying Babel ecosystem.

npm install babel-preset-cf
INSTALL
IMPORT
SIG · BABEL-PRESET-CF
B
babel-preset-cf
devopsjavascriptv2.0.0
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
module.exports = { presets: ['cf'] };
import cf from 'babel-preset-cf';
Presets are referenced as string in Babel config, not imported directly.
default
require('@babel/core').transform('code', { presets: ['cf'] });
require('@babel/core').transform('code', { presets: [require('babel-preset-cf')] });
Use string 'cf' instead of requiring the package.
default
<script src="node_modules/babel-preset-cf/index.js"></script>
<script src="node_modules/babel-preset-cf/dist/index.js"></script>
Browser usage is uncommon; no dist file exists.

Install the preset and add it to your .babelrc file to enable Cloudflare-targeted Babel transforms.

// Install: npm install --save-dev babel-preset-cf // .babelrc { "presets": ["cf"] } // Then run babel on your files // npx babel src --out-dir lib
Debug
Known issues
gotchaThe preset does not include polyfills for modern JS APIs; you may need @babel/polyfill or core-js separately.
fix
Install and configure @babel/preset-env or add polyfills manually.
affects: >=1.0.0
deprecatedThis preset may be incompatible with newer Babel versions (>=7.0.0).
fix
Use '@babel/preset-env' with target 'cloudflare' or check for updated compatibility.
affects: >=2.0.0
breakingVersion 2.0.0 dropped support for Node.js <10.
fix
Upgrade Node.js to version 10 or later.
affects: >=2.0.0
Errors
Common errors & fixes
Cannot find module 'babel-preset-cf'
Package not installed or not in node_modules.
fix
Run 'npm install --save-dev babel-preset-cf' or ensure it's in dependencies.
Unknown preset "cf" in .babelrc
Babel cannot resolve the preset by its short name.
fix
Use fully qualified name: 'babel-preset-cf' or ensure module is installed and Babel version is compatible.
Upgrade
Version history
2.0.0latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
6 hits · last 30 days
node
6
Resources
babel-preset-cf — npm install babel-preset-cf · libregistry