[{"data":1,"prerenderedAt":984},["ShallowReactive",2],{"content:\u002Fjavascript-bundle-optimization-code-splitting\u002Fpolyfills-and-differential-serving\u002Fauditing-core-js-polyfill-weight":3,"surroundings:\u002Fjavascript-bundle-optimization-code-splitting\u002Fpolyfills-and-differential-serving\u002Fauditing-core-js-polyfill-weight":976},{"id":4,"title":5,"body":6,"description":955,"extension":956,"meta":957,"navigation":969,"path":970,"seo":971,"stem":974,"__hash__":975},"content\u002Fjavascript-bundle-optimization-code-splitting\u002Fpolyfills-and-differential-serving\u002Fauditing-core-js-polyfill-weight\u002Findex.md","Auditing core-js Polyfill Weight",{"type":7,"value":8,"toc":939},"minimark",[9,14,43,46,203,208,255,259,271,286,292,304,379,383,388,487,490,494,504,534,537,541,549,553,556,624,627,753,757,763,767,810,814,834,838,847,851,863,882,897,901,924,929,932,935],[10,11,13],"h1",{"id":12},"how-to-audit-core-js-polyfill-weight-in-your-bundle","How to Audit core-js Polyfill Weight in Your Bundle",[15,16,17,18,23,24,28,29,33,34,37,38,42],"p",{},"This guide belongs to ",[19,20,22],"a",{"href":21},"\u002Fjavascript-bundle-optimization-code-splitting\u002Fpolyfills-and-differential-serving\u002F","Polyfills & Differential Serving"," within ",[19,25,27],{"href":26},"\u002Fjavascript-bundle-optimization-code-splitting\u002F","JavaScript Bundle Optimization & Code Splitting",". ",[30,31,32],"code",{},"core-js"," is the standard polyfill library behind Babel's ",[30,35,36],{},"preset-env",", and it is extremely thorough: it polyfills not only missing features but also features with ",[39,40,41],"em",{},"bugs"," in specific engine versions. That thoroughness means a bundle can carry dozens of polyfill modules even when targeting reasonably modern browsers, often for edge-case spec compliance your code never depends on.",[15,44,45],{},"An audit answers three questions: which polyfills are in the bundle, why each was included (which browser in your matrix, which code using which feature), and whether removing it is safe. Most audits find a mix of polyfills that are genuinely needed for a recent API, polyfills that exist because the Browserslist query is outdated, and a whole-library import someone added years ago \"to be safe\".",[15,47,48],{},[49,50,56,57,56,64,56,68,56,71,56,89,56,97,56,103,56,111,56,118,56,123,56,127,56,133,56,137,56,140,56,143,56,146,56,150,56,153,56,156,56,159,56,163,56,166,56,169,56,172,56,176,56,179,56,182,56,191,56,195,56,199,56],"svg",{"viewBox":51,"width":52,"role":53,"ariaLabel":54,"style":55},"0 0 760 149","100%","img","Steps of a polyfill audit from listing included modules to removing unnecessary ones and verifying.","height:auto;max-width:760px;display:block;margin:1.75rem auto;font-family:inherit;color:var(--fp-svg-ink)"," ",[58,59],"rect",{"className":60,"x":62,"y":62,"width":52,"height":52,"fill":63},[61],"svg-canvas","0","#ffffff",[65,66,67],"title",{},"core-js audit workflow",[69,70,54],"desc",{},[72,73,74],"defs",{},[75,76,83],"marker",{"id":77,"viewBox":78,"refX":79,"refY":80,"markerWidth":81,"markerHeight":81,"orient":82},"fa95c58c3b","0 0 10 10","9","5","7","auto-start-reverse",[84,85],"path",{"d":86,"fill":87,"style":88},"M0 0 L10 5 L0 10 z","currentColor","fill-opacity:0.7",[58,90],{"x":91,"y":91,"width":92,"height":93,"rx":94,"fill":95,"stroke":87,"style":96},"1","758","147","10","none","stroke-opacity:0.18",[98,99,67],"text",{"x":100,"y":101,"fill":87,"style":102},"28.0","34.0","font-size:16px;font-weight:700",[58,104],{"x":100,"y":105,"width":106,"height":107,"rx":108,"fill":109,"stroke":109,"style":110},"56.0","108.8","71.0","6","#0466c8","fill-opacity:0.14;stroke-opacity:0.9",[98,112,117],{"x":113,"y":114,"fill":87,"style":115,"textAnchor":116},"82.4","78.0","font-size:13px;font-weight:700","middle","List modules",[98,119,122],{"x":113,"y":120,"fill":87,"style":121,"textAnchor":116},"96.0","font-size:12px","debug output +",[98,124,126],{"x":113,"y":125,"fill":87,"style":121,"textAnchor":116},"112.0","maps",[58,128],{"x":129,"y":105,"width":106,"height":107,"rx":108,"fill":130,"stroke":131,"style":132},"176.8","#ffc300","#b8860b","fill-opacity:0.24;stroke-opacity:0.9",[98,134,136],{"x":135,"y":114,"fill":87,"style":115,"textAnchor":116},"231.2","Attribute",[98,138,139],{"x":135,"y":120,"fill":87,"style":121,"textAnchor":116},"which browser",[98,141,142],{"x":135,"y":125,"fill":87,"style":121,"textAnchor":116},"needs it",[58,144],{"x":145,"y":105,"width":106,"height":107,"rx":108,"fill":109,"stroke":109,"style":110},"325.6",[98,147,149],{"x":148,"y":114,"fill":87,"style":115,"textAnchor":116},"380.0","Classify",[98,151,152],{"x":148,"y":120,"fill":87,"style":121,"textAnchor":116},"needed \u002F stale \u002F",[98,154,155],{"x":148,"y":125,"fill":87,"style":121,"textAnchor":116},"blanket",[58,157],{"x":158,"y":105,"width":106,"height":107,"rx":108,"fill":109,"stroke":109,"style":110},"474.4",[98,160,162],{"x":161,"y":114,"fill":87,"style":115,"textAnchor":116},"528.8","Remove",[98,164,165],{"x":161,"y":120,"fill":87,"style":121,"textAnchor":116},"config or import",[98,167,168],{"x":161,"y":125,"fill":87,"style":121,"textAnchor":116},"change",[58,170],{"x":171,"y":105,"width":106,"height":107,"rx":108,"fill":109,"stroke":109,"style":110},"623.2",[98,173,175],{"x":174,"y":114,"fill":87,"style":115,"textAnchor":116},"677.6","Verify",[98,177,178],{"x":174,"y":120,"fill":87,"style":121,"textAnchor":116},"tests in oldest",[98,180,181],{"x":174,"y":125,"fill":87,"style":121,"textAnchor":116},"target",[183,184],"line",{"x1":185,"y1":186,"x2":187,"y2":186,"stroke":87,"strokeWidth":188,"style":189,"markerEnd":190},"136.8","91.5","174.8","1.5","stroke-opacity:0.6","url(#fa95c58c3b)",[183,192],{"x1":193,"y1":186,"x2":194,"y2":186,"stroke":87,"strokeWidth":188,"style":189,"markerEnd":190},"285.6","323.6",[183,196],{"x1":197,"y1":186,"x2":198,"y2":186,"stroke":87,"strokeWidth":188,"style":189,"markerEnd":190},"434.4","472.4",[183,200],{"x1":201,"y1":186,"x2":202,"y2":186,"stroke":87,"strokeWidth":188,"style":189,"markerEnd":190},"583.2","621.2",[204,205,207],"h2",{"id":206},"rapid-diagnosis","Rapid Diagnosis",[209,210,211,230,236,245],"ul",{},[212,213,214,56,218,221,222,225,226,229],"li",{},[215,216,217],"strong",{},"Search the entry for blanket imports:",[30,219,220],{},"import 'core-js'",", ",[30,223,224],{},"import 'core-js\u002Fstable'"," or ",[30,227,228],{},"import '@babel\u002Fpolyfill'"," include everything for your targets regardless of usage.",[212,231,232,235],{},[215,233,234],{},"Run Babel with debug output"," to see which polyfills each file triggers and which target browser requires them.",[212,237,238,241,242,244],{},[215,239,240],{},"Look at the treemap"," for a ",[30,243,32],{}," block; its size tells you whether this audit is worth an afternoon (over 10KB compressed usually is).",[212,246,247,254],{},[215,248,249,250,253],{},"Check ",[30,251,252],{},"corejs"," version in Babel config."," An unpinned or old minor version makes Babel's decisions less precise.",[204,256,258],{"id":257},"root-cause-analysis","Root Cause Analysis",[15,260,261,56,264,267,268,270],{},[215,262,263],{},"1. Blanket polyfill imports.",[30,265,266],{},"useBuiltIns: 'entry'"," with ",[30,269,224],{}," expands into every polyfill required by any browser in the matrix — regardless of whether your code uses those features.",[15,272,273,56,276,278,279,225,282,285],{},[215,274,275],{},"2. Bug-fix polyfills.",[30,277,32],{}," replaces native implementations known to be buggy in certain versions. If one old Safari in your matrix has a ",[30,280,281],{},"Promise",[30,283,284],{},"Array.prototype.sort"," quirk, every user gets the replacement.",[15,287,288,291],{},[215,289,290],{},"3. Outdated targets."," A matrix including browsers from several years ago pulls in polyfills for ES2015–ES2019 features universally supported today.",[15,293,294,56,297,225,300,303],{},[215,295,296],{},"4. Proposals and stage features.",[30,298,299],{},"core-js\u002Fproposals",[30,301,302],{},"shippedProposals: true"," add polyfills for features not yet standardised, often unnecessarily.",[15,305,306],{},[49,307,56,310,56,313,56,316,56,318,56,321,56,323,56,330,56,337,56,342,56,346,56,350,56,354,56,358,56,363,56,367,56,371,56,375,56],{"viewBox":308,"width":52,"role":53,"ariaLabel":309,"style":55},"0 0 760 194","Bar chart of core-js bytes in the bundle under four configurations from blanket import to usage-based with a modern matrix.",[58,311],{"className":312,"x":62,"y":62,"width":52,"height":52,"fill":63},[61],[65,314,315],{},"core-js weight by configuration (same app, brotli)",[69,317,309],{},[58,319],{"x":91,"y":91,"width":92,"height":320,"rx":94,"fill":95,"stroke":87,"style":96},"192",[98,322,315],{"x":100,"y":101,"fill":87,"style":102},[98,324,329],{"x":325,"y":326,"fill":87,"style":327,"textAnchor":328},"238.7","70.0","font-size:13px","end","entry + core-js\u002Fstable, old matrix",[58,331],{"x":332,"y":105,"width":333,"height":334,"rx":335,"fill":130,"stroke":131,"style":336},"250.7","417.3","19","3","fill-opacity:0.7;stroke-opacity:0.9",[98,338,341],{"x":339,"y":326,"fill":87,"style":340},"674.0","font-size:12px;font-weight:600","46KB",[98,343,345],{"x":325,"y":344,"fill":87,"style":327,"textAnchor":328},"101.0","usage, old matrix",[58,347],{"x":332,"y":348,"width":349,"height":334,"rx":335,"fill":130,"stroke":131,"style":336},"87.0","190.5",[98,351,353],{"x":352,"y":344,"fill":87,"style":340},"447.2","21KB",[98,355,357],{"x":325,"y":356,"fill":87,"style":327,"textAnchor":328},"132.0","usage, current matrix",[58,359],{"x":332,"y":360,"width":361,"height":334,"rx":335,"fill":109,"stroke":109,"style":362},"118.0","54.4","fill-opacity:0.55;stroke-opacity:0.9",[98,364,366],{"x":365,"y":356,"fill":87,"style":340},"311.1","6KB",[98,368,370],{"x":325,"y":369,"fill":87,"style":327,"textAnchor":328},"163.0","usage, current matrix, bug-fix review",[58,372],{"x":332,"y":373,"width":374,"height":334,"rx":335,"fill":109,"stroke":109,"style":362},"149.0","27.2",[98,376,378],{"x":377,"y":369,"fill":87,"style":340},"283.9","3KB",[204,380,382],{"id":381},"step-by-step-resolution","Step-by-Step Resolution",[384,385,387],"h3",{"id":386},"_1-list-what-babel-injects-and-why","1. List what Babel injects and why",[389,390,395],"pre",{"className":391,"code":392,"language":393,"meta":394,"style":394},"language-javascript shiki shiki-themes github-light-high-contrast github-dark-high-contrast github-light-high-contrast","\u002F\u002F babel.config.js — temporary audit settings.\nmodule.exports = {\n  presets: [['@babel\u002Fpreset-env', { useBuiltIns: 'usage', corejs: '3.40', debug: true }]],\n};\n\u002F\u002F Build once and read the log: each file lists \"Added following core-js polyfills:\"\n\u002F\u002F with the browsers that require each one.\n\u002F\u002F trade-off: debug output is extremely verbose on large apps. Redirect it to a\n\u002F\u002F file and grep for the polyfills you suspect, rather than reading it all.\n","javascript","",[30,396,397,405,426,457,463,469,475,481],{"__ignoreMap":394},[398,399,401],"span",{"class":183,"line":400},1,[398,402,404],{"class":403},"sjfSM","\u002F\u002F babel.config.js — temporary audit settings.\n",[398,406,408,412,416,419,423],{"class":183,"line":407},2,[398,409,411],{"class":410},"sPXB4","module",[398,413,415],{"class":414},"saISM",".",[398,417,418],{"class":410},"exports",[398,420,422],{"class":421},"sPARh"," =",[398,424,425],{"class":414}," {\n",[398,427,429,432,436,439,442,445,448,451,454],{"class":183,"line":428},3,[398,430,431],{"class":414},"  presets: [[",[398,433,435],{"class":434},"sZ8jY","'@babel\u002Fpreset-env'",[398,437,438],{"class":414},", { useBuiltIns: ",[398,440,441],{"class":434},"'usage'",[398,443,444],{"class":414},", corejs: ",[398,446,447],{"class":434},"'3.40'",[398,449,450],{"class":414},", debug: ",[398,452,453],{"class":410},"true",[398,455,456],{"class":414}," }]],\n",[398,458,460],{"class":183,"line":459},4,[398,461,462],{"class":414},"};\n",[398,464,466],{"class":183,"line":465},5,[398,467,468],{"class":403},"\u002F\u002F Build once and read the log: each file lists \"Added following core-js polyfills:\"\n",[398,470,472],{"class":183,"line":471},6,[398,473,474],{"class":403},"\u002F\u002F with the browsers that require each one.\n",[398,476,478],{"class":183,"line":477},7,[398,479,480],{"class":403},"\u002F\u002F trade-off: debug output is extremely verbose on large apps. Redirect it to a\n",[398,482,484],{"class":183,"line":483},8,[398,485,486],{"class":403},"\u002F\u002F file and grep for the polyfills you suspect, rather than reading it all.\n",[15,488,489],{},"Expected outcome: for each polyfill, the target browser(s) that triggered it.",[384,491,493],{"id":492},"_2-replace-blanket-imports-with-usage-based-polyfilling","2. Replace blanket imports with usage-based polyfilling",[15,495,496,497,499,500,503],{},"Remove ",[30,498,224],{}," from the entry and switch to ",[30,501,502],{},"useBuiltIns: 'usage'"," so polyfills are injected only where features are used.",[389,505,507],{"className":391,"code":506,"language":393,"meta":394,"style":394},"\u002F\u002F Before (entry file):  import 'core-js\u002Fstable'; import 'regenerator-runtime\u002Fruntime';\n\u002F\u002F After: no imports; Babel injects what each file needs.\n\u002F\u002F trade-off: usage detection is static. Features reached dynamically — e.g.\n\u002F\u002F obj[methodName]() — or used by un-transpiled node_modules are not detected.\n\u002F\u002F Add those few polyfills explicitly in the entry.\n",[30,508,509,514,519,524,529],{"__ignoreMap":394},[398,510,511],{"class":183,"line":400},[398,512,513],{"class":403},"\u002F\u002F Before (entry file):  import 'core-js\u002Fstable'; import 'regenerator-runtime\u002Fruntime';\n",[398,515,516],{"class":183,"line":407},[398,517,518],{"class":403},"\u002F\u002F After: no imports; Babel injects what each file needs.\n",[398,520,521],{"class":183,"line":428},[398,522,523],{"class":403},"\u002F\u002F trade-off: usage detection is static. Features reached dynamically — e.g.\n",[398,525,526],{"class":183,"line":459},[398,527,528],{"class":403},"\u002F\u002F obj[methodName]() — or used by un-transpiled node_modules are not detected.\n",[398,530,531],{"class":183,"line":465},[398,532,533],{"class":403},"\u002F\u002F Add those few polyfills explicitly in the entry.\n",[15,535,536],{},"Expected outcome: polyfill weight drops to what your code demonstrably uses.",[384,538,540],{"id":539},"_3-remove-polyfills-required-only-by-browsers-you-no-longer-support","3. Remove polyfills required only by browsers you no longer support",[15,542,543,544,548],{},"Cross-reference the debug output with your support policy. If a polyfill is required only by browsers outside the policy, tighten Browserslist (see ",[19,545,547],{"href":546},"\u002Fjavascript-bundle-optimization-code-splitting\u002Fpolyfills-and-differential-serving\u002Fremoving-unneeded-polyfills-with-browserslist\u002F","removing unneeded polyfills with Browserslist",") rather than excluding modules one by one.",[384,550,552],{"id":551},"_4-exclude-specific-polyfills-you-have-decided-not-to-ship","4. Exclude specific polyfills you have decided not to ship",[15,554,555],{},"For a handful of bug-fix polyfills whose edge cases your code does not exercise, exclude them explicitly — and document why.",[389,557,559],{"className":391,"code":558,"language":393,"meta":394,"style":394},"['@babel\u002Fpreset-env', {\n  useBuiltIns: 'usage', corejs: '3.40',\n  exclude: ['es.array.sort', 'es.string.replace'],   \u002F\u002F engine quirks we do not depend on\n}]\n\u002F\u002F trade-off: excluding a bug-fix polyfill means the buggy native behaviour is\n\u002F\u002F what affected users get. Only exclude after confirming your code does not\n\u002F\u002F rely on the fixed behaviour, and record the decision next to the config.\n",[30,560,561,571,585,604,609,614,619],{"__ignoreMap":394},[398,562,563,566,568],{"class":183,"line":400},[398,564,565],{"class":414},"[",[398,567,435],{"class":434},[398,569,570],{"class":414},", {\n",[398,572,573,576,578,580,582],{"class":183,"line":407},[398,574,575],{"class":414},"  useBuiltIns: ",[398,577,441],{"class":434},[398,579,444],{"class":414},[398,581,447],{"class":434},[398,583,584],{"class":414},",\n",[398,586,587,590,593,595,598,601],{"class":183,"line":428},[398,588,589],{"class":414},"  exclude: [",[398,591,592],{"class":434},"'es.array.sort'",[398,594,221],{"class":414},[398,596,597],{"class":434},"'es.string.replace'",[398,599,600],{"class":414},"],   ",[398,602,603],{"class":403},"\u002F\u002F engine quirks we do not depend on\n",[398,605,606],{"class":183,"line":459},[398,607,608],{"class":414},"}]\n",[398,610,611],{"class":183,"line":465},[398,612,613],{"class":403},"\u002F\u002F trade-off: excluding a bug-fix polyfill means the buggy native behaviour is\n",[398,615,616],{"class":183,"line":471},[398,617,618],{"class":403},"\u002F\u002F what affected users get. Only exclude after confirming your code does not\n",[398,620,621],{"class":183,"line":477},[398,622,623],{"class":403},"\u002F\u002F rely on the fixed behaviour, and record the decision next to the config.\n",[15,625,626],{},"Expected outcome: remaining polyfills are each justified by a supported browser and a used feature.",[15,628,629],{},[49,630,56,633,56,636,56,639,56,641,56,644,56,646,56,651,56,658,56,662,56,666,56,669,56,673,56,677,56,681,56,683,56,686,56,688,56,691,56,695,56,699,56,703,56,705,56,709,56,711,56,714,56,717,56,721,56,725,56,727,56,731,56,733,56,736,56,739,56,743,56,745,56,748,56,750,56],{"viewBox":631,"width":52,"role":53,"ariaLabel":632,"style":55},"0 0 760 260","Three categories of polyfills found in an audit with the action to take for each.",[58,634],{"className":635,"x":62,"y":62,"width":52,"height":52,"fill":63},[61],[65,637,638],{},"Classifying each polyfill found",[69,640,632],{},[58,642],{"x":91,"y":91,"width":92,"height":643,"rx":94,"fill":95,"stroke":87,"style":96},"258",[98,645,638],{"x":100,"y":101,"fill":87,"style":102},[58,647],{"x":100,"y":105,"width":648,"height":649,"rx":62,"fill":87,"stroke":87,"style":650},"210.0","30.0","fill-opacity:0.06;stroke-opacity:0.4",[98,652,657],{"x":653,"y":654,"fill":87,"style":655,"textAnchor":656},"38.0","75.5","font-size:12.5px;font-weight:700","start","Category",[58,659],{"x":660,"y":105,"width":661,"height":649,"rx":62,"fill":87,"stroke":87,"style":650},"238.0","247.0",[98,663,665],{"x":664,"y":654,"fill":87,"style":655,"textAnchor":116},"361.5","Example",[58,667],{"x":668,"y":105,"width":661,"height":649,"rx":62,"fill":87,"stroke":87,"style":650},"485.0",[98,670,672],{"x":671,"y":654,"fill":87,"style":655,"textAnchor":116},"608.5","Action",[58,674],{"x":100,"y":675,"width":648,"height":649,"rx":62,"fill":95,"stroke":87,"style":676},"86.0","stroke-opacity:0.35",[98,678,680],{"x":653,"y":679,"fill":87,"style":655,"textAnchor":656},"105.5","Needed for a recent API",[58,682],{"x":660,"y":675,"width":661,"height":649,"rx":62,"fill":95,"stroke":87,"style":676},[98,684,685],{"x":664,"y":679,"fill":87,"style":121,"textAnchor":116},"es.array.find-last, structured-clone",[58,687],{"x":668,"y":675,"width":661,"height":649,"rx":62,"fill":109,"stroke":109,"style":110},[98,689,690],{"x":671,"y":679,"fill":87,"style":121,"textAnchor":116},"keep",[58,692],{"x":100,"y":693,"width":648,"height":694,"rx":62,"fill":95,"stroke":87,"style":676},"116.0","46.0",[98,696,698],{"x":653,"y":697,"fill":87,"style":655,"textAnchor":656},"135.5","Needed only by unsupported",[98,700,702],{"x":653,"y":701,"fill":87,"style":655,"textAnchor":656},"151.5","browsers",[58,704],{"x":660,"y":693,"width":661,"height":694,"rx":62,"fill":95,"stroke":87,"style":676},[98,706,708],{"x":664,"y":707,"fill":87,"style":121,"textAnchor":116},"143.5","es.promise, es.symbol",[58,710],{"x":668,"y":693,"width":661,"height":694,"rx":62,"fill":130,"stroke":131,"style":132},[98,712,713],{"x":671,"y":707,"fill":87,"style":121,"textAnchor":116},"tighten Browserslist",[58,715],{"x":100,"y":716,"width":648,"height":694,"rx":62,"fill":95,"stroke":87,"style":676},"162.0",[98,718,720],{"x":653,"y":719,"fill":87,"style":655,"textAnchor":656},"181.5","Bug-fix for an edge case you",[98,722,724],{"x":653,"y":723,"fill":87,"style":655,"textAnchor":656},"197.5","avoid",[58,726],{"x":660,"y":716,"width":661,"height":694,"rx":62,"fill":95,"stroke":87,"style":676},[98,728,730],{"x":664,"y":729,"fill":87,"style":121,"textAnchor":116},"189.5","es.array.sort",[58,732],{"x":668,"y":716,"width":661,"height":694,"rx":62,"fill":87,"stroke":87,"style":650},[98,734,735],{"x":671,"y":729,"fill":87,"style":121,"textAnchor":116},"exclude with a note",[58,737],{"x":100,"y":738,"width":648,"height":649,"rx":62,"fill":95,"stroke":87,"style":676},"208.0",[98,740,742],{"x":653,"y":741,"fill":87,"style":655,"textAnchor":656},"227.5","Blanket import leftovers",[58,744],{"x":660,"y":738,"width":661,"height":649,"rx":62,"fill":95,"stroke":87,"style":676},[98,746,747],{"x":664,"y":741,"fill":87,"style":121,"textAnchor":116},"core-js\u002Fstable in entry",[58,749],{"x":668,"y":738,"width":661,"height":649,"rx":62,"fill":130,"stroke":131,"style":132},[98,751,752],{"x":671,"y":741,"fill":87,"style":121,"textAnchor":116},"remove import",[204,754,756],{"id":755},"verification","Verification",[15,758,759,760,762],{},"Rebuild and compare the ",[30,761,32],{}," block in the treemap. Run the full end-to-end suite in the oldest browser version your policy supports — this is the step that catches an over-aggressive exclusion. Measure TBT before and after on a throttled run; polyfill evaluation happens at startup, so removing tens of kilobytes typically trims 10–30ms from startup tasks on mid-tier devices.",[204,764,766],{"id":765},"common-mistakes","Common Mistakes",[209,768,769,775,787,797],{},[212,770,771,774],{},[215,772,773],{},"Removing polyfills without a test in old browsers."," Modern dev machines never exercise polyfills; a missing one surfaces only in production for the affected users.",[212,776,777,780,781,783,784,786],{},[215,778,779],{},"Polyfilling in libraries and the app."," A library that ships its own ",[30,782,32],{}," copy duplicates modules your app also includes; check the treemap for multiple ",[30,785,32],{}," paths.",[212,788,789,796],{},[215,790,791,792,795],{},"Leaving ",[30,793,794],{},"regenerator-runtime"," after raising targets."," If all supported browsers have native async\u002Fgenerators, the runtime should disappear; if it remains, something (often a dependency) still requires it.",[212,798,799,805,806,809],{},[215,800,801,802,804],{},"Mixing ",[30,803,252],{}," 2 and 3."," Old dependencies built against ",[30,807,808],{},"core-js@2"," pull in a second, incompatible polyfill set.",[204,811,813],{"id":812},"alternatives-to-core-js-for-specific-gaps","Alternatives to core-js for Specific Gaps",[15,815,816,817,225,820,823,824,826,827,830,831,833],{},"Sometimes a single missing API does not justify the polyfill machinery. Small, targeted polyfills (a few lines for ",[30,818,819],{},"Array.prototype.at",[30,821,822],{},"Object.hasOwn",") can be added manually behind feature checks, at a fraction of the size of the ",[30,825,32],{}," module with its shared internals. For heavier gaps, consider whether the feature is essential: code that uses ",[30,828,829],{},"structuredClone"," purely for convenience can fall back to a JSON round trip in the few browsers lacking it. The aim is not to avoid ",[30,832,32],{}," on principle, but to make every polyfill a conscious choice rather than an inherited default.",[204,835,837],{"id":836},"worked-example-finding-a-forgotten-blanket-import","Worked Example: Finding a Forgotten Blanket Import",[15,839,840,841,843,844,846],{},"An audit of a dashboard application found 41KB (brotli) of ",[30,842,32],{}," even though its Browserslist query was already modern. Babel's debug output showed only six polyfills injected by usage — the rest came from a single line, ",[30,845,224],{},", added to the entry years earlier during an Internet Explorer support push and never removed. Deleting the line removed 35KB immediately. The remaining six polyfills were all legitimate (recent array and Intl methods missing in Safari 15), so they stayed. Total time spent: under an hour, most of it reading the debug log.",[204,848,850],{"id":849},"faq","FAQ",[852,853,856,860],"details",{"className":854},[855],"faq-item",[857,858,859],"summary",{},"Are polyfill services that serve per-browser bundles a good alternative?",[15,861,862],{},"Services that inspect the user agent and return only the polyfills that browser needs can produce very small payloads for modern browsers. They add a render-blocking third-party request (or a dependency on a self-hosted service), and their trustworthiness matters — a compromised polyfill CDN can inject code into every site using it. Self-host if you use this approach, and weigh it against simply tightening your targets.",[852,864,866,869],{"className":865},[855],[857,867,868],{},"Does TypeScript add polyfills?",[15,870,871,872,874,875,221,878,881],{},"No. The TypeScript compiler down-levels syntax according to its ",[30,873,181],{}," but never adds runtime polyfills. If your TS target is low, you get down-levelled syntax helpers (",[30,876,877],{},"__awaiter",[30,879,880],{},"__generator","); set the TS target to match your matrix or let Babel\u002Fesbuild handle syntax.",[852,883,885,888],{"className":884},[855],[857,886,887],{},"How often should the audit be repeated?",[15,889,890,891,893,894,896],{},"Whenever the support policy changes and at least once a year. ",[30,892,32],{}," releases add polyfills for new features and drop requirements as browsers fix bugs; updating the ",[30,895,252],{}," version alone can change the output.",[204,898,900],{"id":899},"related","Related",[209,902,903,910,917],{},[212,904,905,909],{},[19,906,908],{"href":907},"\u002Fjavascript-bundle-optimization-code-splitting\u002Fpolyfills-and-differential-serving\u002Ftargeting-baseline-browsers-with-esbuild-and-swc\u002F","Targeting baseline browsers with esbuild and SWC"," — syntax lowering without Babel.",[212,911,912,916],{},[19,913,915],{"href":914},"\u002Fjavascript-bundle-optimization-code-splitting\u002Ftree-shaking-and-dead-code-elimination\u002Ffixing-tree-shaking-issues-with-lodash-and-moment\u002F","Fixing tree-shaking issues with lodash and moment"," — other common sources of hidden weight.",[212,918,919,923],{},[19,920,922],{"href":921},"\u002Fjavascript-bundle-optimization-code-splitting\u002Fjavascript-performance-budgets\u002Fmeasuring-javascript-parse-and-compile-cost\u002F","Measuring JavaScript parse and compile cost"," — quantifying what the removed bytes cost.",[925,926,928],"script",{"type":927},"application\u002Fld+json","\n{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@type\": \"HowTo\",\n  \"name\": \"How to Audit core-js Polyfill Weight in Your Bundle\",\n  \"description\": \"A step-by-step audit of the core-js polyfills in a production bundle, from listing them to removing those your supported browsers do not need.\",\n  \"step\": [\n    {\n      \"@type\": \"HowToStep\",\n      \"position\": 1,\n      \"name\": \"List what Babel injects and why\",\n      \"text\": \"Expected outcome: for each polyfill, the target browser(s) that triggered it.\"\n    },\n    {\n      \"@type\": \"HowToStep\",\n      \"position\": 2,\n      \"name\": \"Replace blanket imports with usage-based polyfilling\",\n      \"text\": \"Remove import 'core-js\u002Fstable' from the entry and switch to useBuiltIns: 'usage' so polyfills are injected only where features are used.\"\n    },\n    {\n      \"@type\": \"HowToStep\",\n      \"position\": 3,\n      \"name\": \"Remove polyfills required only by browsers you no longer support\",\n      \"text\": \"Cross-reference the debug output with your support policy.\"\n    },\n    {\n      \"@type\": \"HowToStep\",\n      \"position\": 4,\n      \"name\": \"Exclude specific polyfills you have decided not to ship\",\n      \"text\": \"For a handful of bug-fix polyfills whose edge cases your code does not exercise, exclude them explicitly — and document why.\"\n    }\n  ]\n}\n",[925,930,931],{"type":927},"\n{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@type\": \"TechArticle\",\n  \"headline\": \"How to Audit core-js Polyfill Weight in Your Bundle\",\n  \"description\": \"A step-by-step audit of the core-js polyfills in a production bundle, from listing them to removing those your supported browsers do not need.\",\n  \"datePublished\": \"2026-10-06\",\n  \"dateModified\": \"2026-10-06\",\n  \"author\": {\n    \"@type\": \"Organization\",\n    \"name\": \"frontend-performance.com\"\n  },\n  \"publisher\": {\n    \"@type\": \"Organization\",\n    \"name\": \"frontend-performance.com\"\n  },\n  \"mainEntityOfPage\": {\n    \"@type\": \"WebPage\",\n    \"@id\": \"https:\u002F\u002Ffrontend-performance.com\u002Fjavascript-bundle-optimization-code-splitting\u002Fpolyfills-and-differential-serving\u002Fauditing-core-js-polyfill-weight\u002F\"\n  }\n}\n",[925,933,934],{"type":927},"\n{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@type\": \"BreadcrumbList\",\n  \"itemListElement\": [\n    {\n      \"@type\": \"ListItem\",\n      \"position\": 1,\n      \"name\": \"Home\",\n      \"item\": \"https:\u002F\u002Ffrontend-performance.com\u002F\"\n    },\n    {\n      \"@type\": \"ListItem\",\n      \"position\": 2,\n      \"name\": \"JavaScript Bundle Optimization & Code Splitting\",\n      \"item\": \"https:\u002F\u002Ffrontend-performance.com\u002Fjavascript-bundle-optimization-code-splitting\u002F\"\n    },\n    {\n      \"@type\": \"ListItem\",\n      \"position\": 3,\n      \"name\": \"Polyfills & Differential Serving\",\n      \"item\": \"https:\u002F\u002Ffrontend-performance.com\u002Fjavascript-bundle-optimization-code-splitting\u002Fpolyfills-and-differential-serving\u002F\"\n    },\n    {\n      \"@type\": \"ListItem\",\n      \"position\": 4,\n      \"name\": \"Auditing core-js Polyfill Weight\",\n      \"item\": \"https:\u002F\u002Ffrontend-performance.com\u002Fjavascript-bundle-optimization-code-splitting\u002Fpolyfills-and-differential-serving\u002Fauditing-core-js-polyfill-weight\u002F\"\n    }\n  ]\n}\n",[936,937,938],"style",{},"html pre.shiki code .sjfSM, html code.shiki .sjfSM{--shiki-default:#66707B;--shiki-dark:#BDC4CC;--shiki-light:#66707B}html pre.shiki code .sPXB4, html code.shiki .sPXB4{--shiki-default:#023B95;--shiki-dark:#91CBFF;--shiki-light:#023B95}html pre.shiki code .saISM, html code.shiki .saISM{--shiki-default:#0E1116;--shiki-dark:#F0F3F6;--shiki-light:#0E1116}html pre.shiki code .sPARh, html code.shiki .sPARh{--shiki-default:#A0111F;--shiki-dark:#FF9492;--shiki-light:#A0111F}html pre.shiki code .sZ8jY, html code.shiki .sZ8jY{--shiki-default:#032563;--shiki-dark:#ADDCFF;--shiki-light:#032563}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html .light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html.light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}",{"title":394,"searchDepth":407,"depth":407,"links":940},[941,942,943,949,950,951,952,953,954],{"id":206,"depth":407,"text":207},{"id":257,"depth":407,"text":258},{"id":381,"depth":407,"text":382,"children":944},[945,946,947,948],{"id":386,"depth":428,"text":387},{"id":492,"depth":428,"text":493},{"id":539,"depth":428,"text":540},{"id":551,"depth":428,"text":552},{"id":755,"depth":407,"text":756},{"id":765,"depth":407,"text":766},{"id":812,"depth":407,"text":813},{"id":836,"depth":407,"text":837},{"id":849,"depth":407,"text":850},{"id":899,"depth":407,"text":900},"A step-by-step audit of the core-js polyfills in a production bundle, from listing them to removing those your supported browsers do not need.","md",{"slug":958,"type":959,"breadcrumb":960,"datePublished":968,"dateModified":968},"auditing-core-js-polyfill-weight","article",[961,964,965,966],{"name":962,"url":963},"Home","\u002F",{"name":27,"url":26},{"name":22,"url":21},{"name":5,"url":967},"\u002Fjavascript-bundle-optimization-code-splitting\u002Fpolyfills-and-differential-serving\u002Fauditing-core-js-polyfill-weight\u002F","2026-10-06",true,"\u002Fjavascript-bundle-optimization-code-splitting\u002Fpolyfills-and-differential-serving\u002Fauditing-core-js-polyfill-weight",{"title":972,"description":973},"Auditing core-js Polyfill Weight in Production Bundles","Find which core-js polyfills your bundle ships and why, using Babel debug output, source maps and treemaps, then remove the ones modern browsers never use.","javascript-bundle-optimization-code-splitting\u002Fpolyfills-and-differential-serving\u002Fauditing-core-js-polyfill-weight\u002Findex","Mn5cYQ7z5LaOD1NF2Z-qfc2tt36W9VFPrV8Es-jBiTU",[977,980],{"title":22,"path":978,"stem":979,"children":-1},"\u002Fjavascript-bundle-optimization-code-splitting\u002Fpolyfills-and-differential-serving","javascript-bundle-optimization-code-splitting\u002Fpolyfills-and-differential-serving\u002Findex",{"title":981,"path":982,"stem":983,"children":-1},"Is module\u002Fnomodule Differential Serving Still Worth It?","\u002Fjavascript-bundle-optimization-code-splitting\u002Fpolyfills-and-differential-serving\u002Fis-module-nomodule-differential-serving-still-worth-it","javascript-bundle-optimization-code-splitting\u002Fpolyfills-and-differential-serving\u002Fis-module-nomodule-differential-serving-still-worth-it\u002Findex",1791308077874]