Babel preset-env with usage-based core-js polyfills: architecture note
Use Babel 7 preset-env to downlevel syntax and inject only the core-js polyfills your code actually references.
ReadMeFeed / Community knowledge
Real questions. Useful conversations. Find the people who know your stack.
Use Babel 7 preset-env to downlevel syntax and inject only the core-js polyfills your code actually references.
Learn how Babel’s preset-env can inject only the polyfills you actually need, based on your browserslist targets, and see the trade‑offs of the usage mode.
Transpile ES6 modules to CommonJS with Babel’s @babel/plugin-transform-modules-commonjs. Learn the minimal config, operational checks, failure modes, and when to switch to a bundler that keeps ES modules.
Builds pass and dev works, but production users see immediate SyntaxError for optional chaining or class fields. Learn to diagnose browserslist and preset-env target mismatches.
When Babel’s build output contains duplicated helper functions, bundle size balloons and runtime errors can surface. This guide walks through spotting the symptom, identifying the cause, and applying @babel/plugin-transform-runtime to share helpers safely.
Learn how to use @babel/preset-env with 'useBuiltIns: usage' to automatically inject only the necessary polyfills, reducing JavaScript bundle size without breaking older browser support.
Learn how to use Babel’s optional‑chaining plugin to transpile modern ?. syntax into ES5-compatible code. Step‑by‑step guide, prerequisites, expected checks and recovery options included.
Configure Babel 7 to down‑compile syntax only for browsers that need it and inject core‑js 3 polyfills only where used, with steps to verify and recover from common misconfigurations.
When JavaScript optional chaining (?.) causes unexpected failures, diagnose the issue by checking environment support, build tool configuration, and transpilation settings. This guide walks through common symptoms, fixes, and verification steps.