A Babel preset that wraps @babel/preset-env and babel-polyfill-corejs3 to produce minimal compiled output for environments that support ESM, with improved polyfill handling. Current version 1.0.1, released as a single stable version. It solves the common issue where preset-env conflates helpers and polyfills, leading to unnecessary code. Key differentiators: automatically prevents inclusion of supported builtins, uses finer-grained polyfills via babel-polyfills, excludes niche polyfills (e.g., Symbol.species) by default, and coordinates options between preset-env and polyfill plugin to avoid conflicts. Suitable for library authors targeting modern browsers or Node.js with ESM.
npm install babel-preset-env-modulesVerified import paths — ran on the pinned version, not inferred.
Configure Babel with babel-preset-env-modules for ESM targets with polyfill support.
Use polyfill option instead of manually setting corejs/useBuiltIns in preset-env options.
Consider migrating to direct use of @babel/preset-env with useBuiltIns: 'usage' and corejs option.
Ensure polyfill option is configured to respect modules setting.
npm install babel-preset-env-modules --save-dev
npm install @babel/preset-env --save-dev