Registry / devops / babel-preset-amex

babel-preset-amex

JSON →
library4.0.3jsnpmunverified

Standard Babel preset for American Express, currently at v4.0.3. Maintained by One Amex, it provides a curated set of Babel presets and plugins for transpiling JavaScript and React applications. Includes @babel/preset-env, @babel/preset-react, and plugins for dynamic imports, class properties, export default from, optional chaining, and react-remove-prop-types (production only). Supports configuration for server-only (Node), modern browsers (n-1), and module format (ESM or CommonJS). Differentiated by its opinionated defaults tailored for American Express projects, with a focus on stability and compliance. Release cadence is irregular, with minor updates and patches as needed.

npm install babel-preset-amex
INSTALL
IMPORT
SIG · BABEL-PRESET-AMEX
B
babel-preset-amex
devopsjavascriptv4.0.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.

default
module.exports = { presets: ['amex'] }
import babelPresetAmex from 'babel-preset-amex'
Used in .babelrc or babel.config.js as a preset string, not imported directly. If using babel.config.js with module.exports, string 'amex' is correct.
Use as preset with options
module.exports = { presets: [['amex', { serverOnly: true }]] }
module.exports = { presets: ['amex', { serverOnly: true }] }
Options must be passed as an array pair, not as separate arguments.
CommonJS require
const preset = require('babel-preset-amex');
import preset from 'babel-preset-amex';
The preset is CommonJS; ESM import may cause issues if used in ESM context without proper handling.

Shows how to configure babel-preset-amex in .babelrc or babel.config.js with options for serverOnly, modern, and moduleFormat.

// .babelrc { "presets": [ [ "amex", { "serverOnly": false, "modern": true, "moduleFormat": "esm" } ] ] } // Or babel.config.js module.exports = { presets: [ ['amex', { serverOnly: false, modern: true, moduleFormat: 'esm' }] ] }; // Install npm install --save-dev babel-preset-amex @babel/core
Debug
Known issues
deprecatedv4.0.3 replaced @babel/plugin-proposal-optional-chaining with the standardized plugin @babel/plugin-transform-optional-chaining. Older versions used the proposal plugin.
fix
Update to v4.0.3 or later to use the standardized transform.
affects: <4.0.3
breakingv4.0.0 dropped support for Node 10, 12, and 14. These Node versions are no longer supported by the preset.
fix
Upgrade Node to version 16 or later.
affects: >=4.0.0 <5.0.0
gotchaThe option 'moduleFormat' only supports 'esm' for ESM output; any other string (including 'cjs') defaults to CommonJS. There is no explicit 'cjs' option.
fix
Use 'moduleFormat': 'esm' for ESM; omit or use any other string for CommonJS.
affects: >=3.6.0
gotchaThe preset auto-removes prop-types / dead code only in production mode (NODE_ENV=production). In development, those transforms are skipped.
fix
Ensure NODE_ENV is set correctly to benefit from dead code elimination.
affects: *
deprecatedThe legacy browserlist target includes IE 11 (since v4.0.2). Ensure your app does not need to support IE 11 if you set 'modern' to true.
fix
Use 'modern': true to exclude IE 11 and other legacy browsers.
affects: >=4.0.2
Errors
Common errors & fixes
Module not found: Can't resolve 'babel-preset-amex'
Package not installed or listed as devDependency.
fix
npm install --save-dev babel-preset-amex
Error: Cannot find module '@babel/core'
@babel/core is a required peer dependency not installed.
fix
npm install --save-dev @babel/core
Preset options must be an array, received object
In babel.config.js, the preset is not wrapped in an array when passing options.
fix
Use: presets: [['amex', { ... }]] instead of presets: ['amex', { ... }]
Invalid config: 'moduleFormat' must be a string
The option 'moduleFormat' expects a string value, but got another type.
fix
Set 'moduleFormat': 'esm' or omit/use falsy value for CommonJS.
Upgrade
Version history
4.0.3latest on npm
Audit
Dependencies
@babel/corerequiredPeer dependency required to run any Babel preset
Agent activity
4 hits · last 30 days
node
4
Resources
babel-preset-amex — npm install babel-preset-amex · libregistry