Babel preset-env targets: stop transpiling what browsers already run
A tight target query is what keeps @babel/preset-env from rewriting syntax your users already run. Diff two target sets, keep ES modules for the bundler, and verify the result.
ReadMeFeed / Community knowledge
Real questions. Useful conversations. Find the people who know your stack.
A tight target query is what keeps @babel/preset-env from rewriting syntax your users already run. Diff two target sets, keep ES modules for the bundler, and verify the result.
Stop shipping unnecessary polyfills. Learn how to use @babel/preset-env's useBuiltIns option to automatically inject only the code your target browsers actually need.
Stop shipping all of core-js/stable. Choose the right CoreJS entry point, wire up Babel's useBuiltIns: 'usage', and verify the bundle actually shrank.
Global polyfills bloat bundles and mutate prototypes. Learn how core-js/pure with Babel's usage mode injects only the polyfills your code actually needs, with config, example, and pitfalls.
Use @babel/preset-env with useBuiltIns: "usage" to have Babel inject only the core-js polyfills your code actually uses for the browsers you target, keeping legacy bundles smaller.
Hardcoded Babel targets either bloat your bundle or break old browsers. Here's how browserslist-driven preset-env config, core-js injection, and the debug flag turn transpilation into an auditable decision.
Stop bloating your JS bundles with unnecessary polyfills. Learn how to use Babel's useBuiltIns: 'usage' to inject only the code your target browsers actually need.
Babel’s useBuiltIns option in @babel/preset‑env lets you auto‑inject polyfills only for the features you actually use. This reduces bundle size, speeds up load times, and keeps your codebase lean. Learn how to configure it, see a concrete example, and understand the trade‑offs.
Configure @babel/preset-env with useBuiltIns: 'usage' and core-js 3 so Babel injects only the polyfills your browserslist targets need — plus how to verify and roll back.