Skip to content

Upgrading core-js 2 to 3

Breaking2.6.12 → 3.51.0Breaking26Security2Platform3Deprecated3New192Changed413Fixed448Other190

BreakingUpgrade verdict

26 breaking changes and 3 platform requirement changes and 2 security fixes.

  • 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.
Top 5 of 34 that need code or config changes

Requires Node.js * from 3.50.0 (none stated before).

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.takelimit
Map, 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.of
Removes sort from Set.prototype.intersection per the March 2023 TC39 meeting.
Set.prototype.intersection
Renames Iterator.prototype.asIndexedPairs and AsyncIterator.prototype.asIndexedPairs to .indexed per iterator helpers proposal update.
Iterator.prototype.asIndexedPairsIterator.prototype.indexedAsyncIterator.prototype.asIndexedPairsAsyncIterator.prototype.indexed
Removes .throw methods from all iterator wrappers and helper prototypes.
.throw
Removes %TypedArray%.prototype.toSpliced from the change array by copy proposal and marks it obsolete in core-js.
%TypedArray%.prototype.toSpliced
Renames Array grouping methods: groupBy becomes group and groupByToMap becomes groupToMap.
Array.prototype.groupByArray.prototype.groupArray.prototype.groupByToMapArray.prototype.groupToMap
Removes @@species support from the Array grouping proposal implementation.
@@species
Removes own AggregateError#toString, per tc39/proposal-promise-any/49.
AggregateError#toString
Renames 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-end
Renames global to globalThis per tc39/proposal-global@2a4cf86.
globalglobalThis
Renames Set.prototype.intersect to Set.prototype.intersection per the set-methods proposal.
Set.prototype.intersectSet.prototype.intersection
Moves the pattern matching proposal to stage 1 and removes Symbol.patternValue.
Symbol.patternValue
Renames Array.prototype.flatten to Array.prototype.flat based on the May 2018 TC39 meeting.
Array.prototype.flattenArray.prototype.flat
Renames Set.prototype.except to Set.prototype.difference.
Set.prototype.exceptSet.prototype.difference
Renames Set.prototype.xor to Set.prototype.symmetricDifference.
Set.prototype.xorSet.prototype.symmetricDifference
Removes 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.split
Replaces Iterator.prototype.sliding with an extra parameter of Iterator.prototype.windows.
Iterator.prototype.slidingIterator.prototype.windows
Replaces Math.clamp with Number.prototype.clamp in the stage 2 clamp proposal.
Math.clampNumber.prototype.clamp
Extracts Decorator Metadata as a separate stage 2 proposal, replacing Symbol.metadata with Symbol.metadataKey.
Symbol.metadataKeySymbol.metadata
Array.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.filterOut
String#matchAll and String#replaceAll now throw an error on a non-global regex argument, per the TC39 decision.
String#matchAllString#replaceAll
Removes the web.url-search-params.sort module because engines lacking URLSearchParams#sort fail constructor tests.
web.url-search-params.sortURLSearchParams#sortURLSearchParams
Replaces the old stage 0 asap proposal with queueMicrotask from the HTML spec.
asapqueueMicrotask
Security2
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.trimRightparseIntparseFloatNumberatobURL
Fixes possible exposing of collections elements metadata in some cases.
Platform3
Marks Array.fromAsync as supported from Deno 1.38.
Array.fromAsync
Marks Symbol.dispose and Symbol.asyncDispose as supported from Deno 1.38.
Symbol.disposeSymbol.asyncDispose
Adds Deno support, after bundling since Deno does not support CommonJS.
Deno
Deprecated3
Keeps the oculus and opera_mobile compat data fields until the next major release.
oculusopera_mobile
Deprecates the core-js-builder blacklist option in favor of exclude.
core-js-builderblacklistexclude
Replaces 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