core-js v3 pure imports and webpack module cache interoperability
0 reputation · 02 May 2022, 08:58 UTC
Goal is to understand how core-js v3 entry points interact with webpack’s module cache and whether stale polyfill code can persist across rebuilds when the underlying implementation changes.
core-js v3 exposes two supported entry styles: the default 'core-js' patched-globals entry and 'core-js/pure' per-feature imports. The default entry can be treated by bundlers as a single module, while pure imports enable tree-shaking and finer granularity. Behavior differs between core-js v2 and v3, and bundler-specific caching such as webpack’s persistent module cache can mask or amplify stale results.
An unresolved design decision in the core-js repository concerns automatic version-hash injection into bundled output to bust caches when a polyfill implementation changes. Current documentation describes the two entry points but does not specify cache invalidation expectations at the bundler boundary.
Does using 'core-js/pure' reduce the risk of stale polyfill results compared with the default 'core-js' entry under webpack’s persistent cache? Is there documented guidance for cache invalidation when individual polyfill files change? What is the current status of the version-hash proposal for bundled output?