Registry / web-framework / babel-preset-env

babel-preset-env

JSON →
library1.7.0jsnpmunverified

A Babel preset that automatically determines the transforms and polyfills needed for target environments (browsers or Node.js versions) based on browserslist queries. Version 1.7.0 is the last stable release before merging into the Babel monorepo. Deprecated in favor of @babel/preset-env (Babel 7). No longer maintained as a standalone package. Use @babel/preset-env for continued support and updates.

npm install babel-preset-env
INSTALL
IMPORT
SIG · BABEL-PRESET-ENV
B
babel-preset-env
web-frameworkjavascriptv1.7.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.

preset-env (preset)
module.exports = { presets: ['env'] }
import env from 'babel-preset-env'
This is a Babel preset, not a module to import directly. Use it in .babelrc or babel config.
useBuiltIns option
['env', { useBuiltIns: 'usage' }]
['env', { useBuiltIns: true }]
In v2 alpha, useBuiltIns: true was renamed to 'usage'. In v1, true is invalid; use 'entry' or 'usage'.
targets option
['env', { targets: { browsers: 'last 2 versions' } }]
['env', { targets: { browsers: 'last 2 versions' } }]
Use browserslist query string or object with browser/Node versions. In v1.5+, versions can be strings.

Configure babel-preset-env with browserslist targets and useBuiltIns for automatic polyfill inclusion.

// .babelrc { "presets": [ ["env", { "targets": { "browsers": ["> 0.25%", "not dead"] }, "useBuiltIns": "usage", "corejs": 2 }] ] } // Then in your build script: // npx babel src --out-dir lib // For polyfills, ensure core-js@2 is installed.
Debug
Known issues
deprecatedbabel-preset-env is deprecated. Use @babel/preset-env for Babel 7+.
fix
Replace 'babel-preset-env' with '@babel/preset-env' and update Babel to v7+.
affects: >=1.0.0
breakinguseBuiltIns: true was renamed to 'usage' in v2 alpha. In v1, true is invalid.
fix
Use 'entry' or 'usage' (Babel 7) instead of true.
affects: <2.0.0
gotchaWithout specifying targets, it behaves like babel-preset-latest (transpiles everything).
fix
Always set targets to reduce output size and avoid unnecessary transforms.
affects: >=1.0.0
gotchauseBuiltIns: 'entry' requires importing core-js at the entry point (e.g., import 'core-js'). Usage mode does not.
fix
Add import 'core-js' at app entry when using 'entry' mode.
affects: >=1.0.0
Errors
Common errors & fixes
Error: Cannot find module 'babel-preset-env'
Package not installed or typo in name.
fix
npm install babel-preset-env --save-dev
ReferenceError: regeneratorRuntime is not defined
Async/await or generator functions need runtime polyfill.
fix
Add 'transform-runtime' plugin or ensure core-js polyfill includes regenerator.
Module not found: Can't resolve 'core-js/modules/es6.promise'
Using useBuiltIns: 'usage' with outdated core-js.
fix
Install core-js@2 (or 3) and set 'corejs' option accordingly.
Upgrade
Version history
1.7.0latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
14 hits · last 30 days
node
12
OpenAI (training)
1
Resources
babel-preset-env — npm install babel-preset-env · libregistry