babel-preset-stage-3
raw JSON → 6.24.1 verified Sat Apr 25 auth: no javascript deprecated
Babel preset that includes all stage 3 (candidate) ECMAScript proposal plugins. Version 6.24.1 is the last stable release; the package has been deprecated in favor of using individual plugins or preset-env. It was originally part of the Babel 6 ecosystem and is rarely updated. For modern projects, use @babel/preset-env with appropriate targets instead of stage presets.
Common errors
error Error: Plugin 0 specified in "base" provided an invalid property of "default" ↓
cause Incorrectly importing the preset as default export instead of calling it as a function.
fix
Use require('babel-preset-stage-3') directly, not require(...).default.
error Error: Cannot find module 'babel-preset-stage-3' ↓
cause The package wasn't installed or Babel version mismatch (stage-3 only works with Babel 6).
fix
Run npm install --save-dev babel-preset-stage-3 and ensure Babel 6 is used.
error ReferenceError: regeneratorRuntime is not defined ↓
cause Stage-3 preset includes async/await transform which requires regenerator runtime.
fix
Install and include babel-polyfill or babel-runtime in your setup.
Warnings
deprecated Stage presets (including stage-3) are deprecated in Babel 7+. ↓
fix Use @babel/preset-env with appropriate targets or individual plugins like @babel/plugin-transform-object-rest-spread.
breaking Babel 6 is no longer maintained; babel-preset-stage-3 only works with Babel 6. ↓
fix Upgrade to Babel 7+ and replace with @babel/preset-env or specific plugins.
gotcha The preset includes object rest/spread, async functions, etc. which may conflict with other presets or transform settings. ↓
fix Avoid mixing stage presets with preset-env that also includes those transforms. Prefer using only preset-env.
Install
npm install babel-preset-stage-3 yarn add babel-preset-stage-3 pnpm add babel-preset-stage-3 Imports
- preset wrong
import { presets } from 'babel-preset-stage-3'correctmodule.exports = { presets: ['stage-3'] }; - default wrong
require('babel-preset-stage-3').defaultcorrectrequire('babel-preset-stage-3')({ useBuiltIns: false }) - plugins wrong
const { plugins } = require('babel-preset-stage-3');correctconst preset = require('babel-preset-stage-3'); console.log(preset.plugins);
Quickstart
// .babelrc
{
"presets": ["stage-3"]
}
// or via Node API
const babel = require('babel-core');
babel.transform('code', { presets: ['stage-3'] });
// then compile
npx babel src --out-dir lib