Ensuring Core‑JS Tree‑Shaking Works with CommonJS Builds
Context For a low‑traffic web app, every kilobyte of JavaScript counts. Core‑JS 3 offers selective imports (e.g., import 'core-js/modules/es.array.flat'; ) and a runtime detector ( import 'core-js/actual'; ) that can trim polyfills. Babel’s useBuiltIns: "usage" automatically injects only the polyfills that the target browsers actually need. However, Core‑JS