Upgrading core-js 2 to 3
Breaking2.6.12 → 3.51.0Breaking26Security2Platform3Deprecated3New192Changed413Fixed448Other190
SecurityFixes theoretically possible ReDoS vulnerabilities in String.prototype trim methods, parse(Int|Float), Number, atob and URL polyfills in some ancient engines.Advisory ↗
BreakingUpgrade verdict
26 breaking changes and 3 platform requirement changes and 2 security fixes.
In plain terms
- Passing a limit too large to represent exactly now raises an error instead of silently misbehaving.
- These static helpers no longer create instances of subclasses; they always return plain built-in collections.
- The Set intersection method no longer sorts its result, matching the updated proposal.
- The method that pairs each item with its position is now called indexed instead of asIndexedPairs.
Must act Top 5 of 34 that need code or config changes
Requires Node.js * from 3.50.0 (none stated before).
What you must change
Breaking26
Throws a RangeError on finite unsafe integer limit in Iterator.prototype.drop and Iterator.prototype.take, following tc39/ecma262#3776.
Iterator.prototype.dropIterator.prototype.takelimitMap, Set, WeakMap and WeakSet from/of become non-generic: callable without this but no longer return subclass instances.
Map.fromMap.ofSet.fromSet.ofWeakMap.fromWeakMap.ofWeakSet.fromWeakSet.ofRemoves sort from Set.prototype.intersection per the March 2023 TC39 meeting.
Set.prototype.intersectionRenames Iterator.prototype.asIndexedPairs and AsyncIterator.prototype.asIndexedPairs to .indexed per iterator helpers proposal update.
Iterator.prototype.asIndexedPairsIterator.prototype.indexedAsyncIterator.prototype.asIndexedPairsAsyncIterator.prototype.indexedRemoves .throw methods from all iterator wrappers and helper prototypes.
.throwRemoves %TypedArray%.prototype.toSpliced from the change array by copy proposal and marks it obsolete in core-js.
%TypedArray%.prototype.toSplicedRenames Array grouping methods: groupBy becomes group and groupByToMap becomes groupToMap.
Array.prototype.groupByArray.prototype.groupArray.prototype.groupByToMapArray.prototype.groupToMapRemoves @@species support from the Array grouping proposal implementation.
@@speciesRemoves own
AggregateError#toString, per tc39/proposal-promise-any/49.AggregateError#toStringRenames esnext.string.trim-left to trim-start and trim-right to trim-end.
esnext.string.trim-leftesnext.string.trim-startesnext.string.trim-rightesnext.string.trim-endRenames
global to globalThis per tc39/proposal-global@2a4cf86.globalglobalThisRenames Set.prototype.intersect to Set.prototype.intersection per the set-methods proposal.
Set.prototype.intersectSet.prototype.intersectionMoves the pattern matching proposal to stage 1 and removes Symbol.patternValue.
Symbol.patternValueRenames Array.prototype.flatten to Array.prototype.flat based on the May 2018 TC39 meeting.
Array.prototype.flattenArray.prototype.flatRenames Set.prototype.except to Set.prototype.difference.
Set.prototype.exceptSet.prototype.differenceRenames Set.prototype.xor to Set.prototype.symmetricDifference.
Set.prototype.xorSet.prototype.symmetricDifferenceRemoves some deprecated entry points.
Renames es.regexp.{match, replace, search, split} modules to es.string.{match, replace, search, split}.
es.regexp.matches.regexp.replacees.regexp.searches.regexp.splites.string.matches.string.replacees.string.searches.string.splitReplaces Iterator.prototype.sliding with an extra parameter of Iterator.prototype.windows.
Iterator.prototype.slidingIterator.prototype.windowsReplaces Math.clamp with Number.prototype.clamp in the stage 2 clamp proposal.
Math.clampNumber.prototype.clampExtracts Decorator Metadata as a separate stage 2 proposal, replacing Symbol.metadata with Symbol.metadataKey.
Symbol.metadataKeySymbol.metadataArray.prototype.filterReject replaces Array.prototype.filterOut in the Array filtering proposal.
Array.prototype.filterRejectArray.prototype.filterOut%TypedArray%.prototype.filterReject replaces %TypedArray%.prototype.filterOut in the Array filtering proposal.
%TypedArray%.prototype.filterReject%TypedArray%.prototype.filterOutString#matchAll and String#replaceAll now throw an error on a non-global regex argument, per the TC39 decision.
String#matchAllString#replaceAllRemoves the web.url-search-params.sort module because engines lacking URLSearchParams#sort fail constructor tests.
web.url-search-params.sortURLSearchParams#sortURLSearchParamsReplaces the old stage 0
asap proposal with queueMicrotask from the HTML spec.asapqueueMicrotaskSecurity2
Fixes theoretically possible ReDoS vulnerabilities in String.prototype trim methods, parse(Int|Float), Number, atob and URL polyfills in some ancient engines.
String.prototype.trimString.prototype.trimEndString.prototype.trimRightparseIntparseFloatNumberatobURLFixes possible exposing of collections elements metadata in some cases.
Platform3
Marks Array.fromAsync as supported from Deno 1.38.
Array.fromAsyncMarks Symbol.dispose and Symbol.asyncDispose as supported from Deno 1.38.
Symbol.disposeSymbol.asyncDisposeAdds Deno support, after bundling since Deno does not support CommonJS.
DenoDeprecations to plan for
Deprecated3
Keeps the oculus and opera_mobile compat data fields until the next major release.
oculusopera_mobileDeprecates the core-js-builder blacklist option in favor of exclude.
core-js-builderblacklistexcludeReplaces Map#upsert and WeakMap#upsert with emplace following the upsert proposal; upsert will be removed in the next major release.
Map#emplaceWeakMap#emplaceMap#upsertWeakMap#upsert