Registry / devops / babel-preset-proposals

babel-preset-proposals

JSON →
library0.4.0jsnpmunverified

A Babel 7 preset that manages experimental proposal plugin dependencies, ordering, and default options. Current version 0.4.0 (released 2021-02-24), requires Node >=10. Key differentiators: automatically handles plugin ordering and option defaults for decorators and pipeline operator, removes plugins handled by @babel/preset-env, and supports all major TC39 proposals via boolean or object configuration. Release cadence is irregular; last release was over 3 years ago. Notable changes include removal of jsonStrings/nullishCoalescingOperator/optionalChaining options in v0.2.0 and addition of classStaticBlock in v0.4.0. This preset helps avoid common misconfigurations of Babel proposal plugins.

npm install babel-preset-proposals
INSTALL
IMPORT
SIG · BABEL-PRESET-PROPO
B
babel-preset-proposals
devopsjavascriptv0.4.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 = require('babel-preset-proposals')
import preset from 'babel-preset-proposals'
This is a CommonJS package; use require() in Node.js or configure in .babelrc/babel.config.js as a preset string.
validateOptions
const { validateOptions } = require('babel-preset-proposals')
import { validateOptions } from 'babel-preset-proposals'
validateOptions is exported as a named export in CommonJS; destructure from require().
PresetOptions
// No TypeScript types shipped; define your own interface
import { PresetOptions } from 'babel-preset-proposals'
This package does not provide TypeScript type definitions. You must create your own type for options.

Shows both .babelrc JSON configuration and programmatic CommonJS usage with options like classProperties, decorators, and loose mode.

// Install: npm install babel-preset-proposals // .babelrc or babel.config.js { "presets": [ ["babel-preset-proposals", { "classProperties": true, "decorators": { "legacy": true }, "exportDefaultFrom": true, "numericSeparator": true, "loose": true }] ] } // Programmatic usage (Node.js CJS): const proposalsPreset = require('babel-preset-proposals'); const babel = require('@babel/core'); const result = babel.transformSync('code', { presets: [[proposalsPreset, { classProperties: true }]] }); console.log(result.code);
Debug
Known issues
breakingRemoved options jsonStrings, nullishCoalescingOperator, optionalChaining; these plugins are now handled by @babel/preset-env (v0.2.0).
fix
Remove these options from preset config; enable via @babel/preset-env's targets or use the plugins directly if needed.
affects: >=0.2.0
breakingDecorators default changed from {legacy: true} to no default; you must explicitly specify {legacy: true} to preserve old behavior (v0.2.0).
fix
Update preset config: replace 'decorators: true' with 'decorators: {legacy: true}' for legacy behavior.
affects: >=0.2.0
breakingNode.js 8 required; dropped support for Node 6 (v0.3.0). v0.4.0 requires Node >=10.
fix
Upgrade Node.js to version 10 or higher for v0.4.0.
affects: >=0.3.0
deprecatedSome proposal plugins like classPrivateMethods and staticClassFeatures are not included; users must add them manually.
fix
Add missing plugins individually, e.g., @babel/plugin-proposal-private-methods.
affects: *
gotchaUsing absolutePaths: true is required if the config is used outside the project's node_modules scope; otherwise Babel may fail to resolve plugins.
fix
Set absolutePaths: true if generating config for external consumption or using with tools like Webpack's babel-loader.
affects: *
Errors
Common errors & fixes
Error: [BABEL] unknown preset: 'babel-preset-proposals'
Package not installed or not in node_modules path.
fix
Run 'npm install babel-preset-proposals' and ensure your .babelrc is in the project root.
Error: Plugin .option is not a valid Plugin property
Passed options not recognized by the preset, e.g., 'optionalChaining: true' in v0.2.0+.
fix
Check the README for valid options; for removed options, use @babel/preset-env or the plugin directly.
TypeError: Cannot read property 'replace' of undefined
Using preset with an invalid option value (e.g., passing a string instead of boolean/object).
fix
Ensure each option is either boolean or an Object as documented.
Upgrade
Version history
0.4.0latest on npm
Audit
Dependencies
@babel/corerequiredPeer dependency required for Babel presets to function
@babel/plugin-proposal-class-propertiesoptionalRequired plugin for class properties proposal
@babel/plugin-proposal-decoratorsoptionalRequired plugin for decorators proposal
@babel/plugin-proposal-pipeline-operatoroptionalRequired plugin for pipeline operator proposal
Agent activity
2 hits · last 30 days
node
2
Resources
babel-preset-proposals — npm install babel-preset-proposals · libregistry