Registry / web-framework / babel-preset-o

babel-preset-o

JSON →
library0.4.3jsnpmunverified

A tiny and flexible Babel preset for React development, combining @babel/preset-env and @babel/preset-react with sensible defaults. Version 0.4.3 is the latest stable release; the package is actively maintained but has limited community adoption. It simplifies configuration by wrapping two commonly used presets into one, supporting custom options for targets, modules, useBuiltIns, and runtime mode (classic or automatic). Compared to alternatives like babel-preset-react-app, this preset is more lightweight and configurable, suitable for projects that need a minimal Babel setup without opinionated defaults.

npm install babel-preset-o
INSTALL
IMPORT
SIG · BABEL-PRESET-O
B
babel-preset-o
web-frameworkjavascriptv0.4.3
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.

babel-preset-o
module.exports = { presets: ['babel-preset-o'] }
module.exports = { presets: [require('babel-preset-o')] }
Use string reference in presets array; requiring is unnecessary but might work if preset is a module.
babel-preset-o with options
module.exports = { presets: [['babel-preset-o', { targets: {}, modules: 'commonjs' }]] }
Options are passed as second element in an array within presets.
customize runtime
module.exports = { presets: [['babel-preset-o', { runtime: 'automatic' }]] }
module.exports = { presets: ['babel-preset-o', { runtime: 'automatic' }] }
When passing options, wrap the preset name and options in a sub-array.

Shows how to install and configure babel-preset-o with custom targets and options for React development.

// Install: npm i -D babel-preset-o // babel.config.js module.exports = { presets: [ ['babel-preset-o', { targets: { browsers: ['> 1%', 'last 2 versions'] }, modules: false, useBuiltIns: false, runtime: 'classic' }] ] }
Debug
Known issues
gotchaPreset options must be passed in an array format: ['babel-preset-o', options]. Omitting the array or misplacing options will silently ignore them.
fix
Use ['babel-preset-o', { ... }] in the presets array.
affects: >=0.0.0
gotchaThe 'runtime' option defaults to 'classic', which uses React.createElement. If using React 17+ JSX transform, set runtime: 'automatic' to avoid unused React imports.
fix
Set runtime: 'automatic' in preset options if using React 17+ and the new JSX transform.
affects: >=0.0.0
deprecatedThe 'useBuiltIns' option is deprecated in Babel 7.4+; prefer using @babel/polyfill or core-js directly.
fix
Consider removing useBuiltIns and installing core-js directly for polyfills.
affects: >=7.4
Errors
Common errors & fixes
Error: Cannot find module '@babel/preset-env'
Missing peer dependency @babel/preset-env
fix
npm install @babel/preset-env @babel/preset-react --save-dev
Preset options object is not being applied
Preset not wrapped in an array with name
fix
Use ['babel-preset-o', { modules: 'commonjs' }] instead of ['babel-preset-o', { modules: 'commonjs' }] (check nesting).
JSX not transpiled, React is undefined
Default runtime is 'classic', requires React in scope
fix
Set runtime: 'automatic' or add import React from 'react' in every JSX file.
Upgrade
Version history
0.4.3latest on npm
Audit
Dependencies
@babel/preset-envrequiredcore dependency for environment-based transpilation
@babel/preset-reactrequiredcore dependency for React JSX and other transforms
Agent activity
11 hits · last 30 days
node
10
OpenAI (training)
1
Resources
babel-preset-o — npm install babel-preset-o · libregistry