--- url: "https://almanac.httparchive.org/en/2024/javascript" titulek: "JavaScript | 2024 | The Web Almanac by HTTP Archive" h1: "JavaScript" popis: "JavaScript chapter of the 2024 Web Almanac covering the usage of JavaScript on the web, libraries and frameworks, compression, web components, and source maps." jazyk: "en" kanonicka: "https://almanac.httparchive.org/en/2024/javascript" drobecky: ["en", "2024"] zdroj: "live" wayback_snapshot: "" stazeno: "2026-09-13 20:14:00" znaku: 50890 slov: 7929 kodovani: "utf-8" sha256: "9346bffdf21f995f7d6b9b0f4c2929694425c31d1a4a73fa3634dc459ad9fa5b" --- Part I Chapter 1 # JavaScript Date published: 2025/03/03 Last updated: 2026/01/16 Written by [Abdul Haddi Amjad](/en/2024/contributors#haddiamjad) and [Nishu Goel](/en/2024/contributors#NishuGoel) Reviewed by [Barry Pollard](/en/2024/contributors#tunetheweb) Analyzed by [Onur Güler](/en/2024/contributors#onurglr) and [Nurullah Demir](/en/2024/contributors#nrllh) Edited by [Barry Pollard](/en/2024/contributors#tunetheweb) ## Introduction JavaScript is essential for creating interactive web experiences, driving everything from basic animations to advanced functionalities. Its development has significantly enhanced the web’s dynamic capabilities. However, this heavy dependence on JavaScript involves compromises. Each stage—from downloading and parsing to execution—demands substantial browser resources. Using too little can compromise user experience and business objectives while overusing it can lead to sluggish load times, unresponsive pages, and poor user engagement. In this chapter, we will re-evaluate JavaScript’s role on the web and offer recommendations for designing smooth, efficient user experiences. ## How much JavaScript do we load? We will analyze the volume of JavaScript being deployed by web developers. Gaining a clear picture of the current state is crucial for driving any impactful improvements. Bar chart of median JavaScript usage from 2019 to 2024 showing a steady increase. Median JavaScript on desktop increased from 391 kilobytes, to 444, to 463, to 509, to 538, to 613 kilobytes in 2024. On mobile, median JavaScript on desktop increased from 359 kilobytes in 2019, to 411, to 427, to 461, to 491, to 558 kilobytes in 2024. Figure 1.1. Median JavaScript kilobytes per page. There has been a continuous increase in the volume of JavaScript. In 2024, this upward trend resumed, with the median JavaScript payload rising by 14%, reaching 558 kilobytes on mobile and 613 kilobytes on desktop. This ongoing trend is concerning. While device capabilities are improving, not everyone has access to the latest technology. Larger JavaScript bundles place additional strain on device resources, impacting performance, especially for users with older or less powerful hardware. ## How many JavaScript requests per page? Every resource on a web page sparks at least one request, but it can snowball quickly if that resource starts pulling in others. Bar chart of median JavaScript requests from 2019 to 2024 showing a steady increase. On desktop usage increased from 19 in 2019 to 23 in 2024, while on mobile it increased from 18 to 22 requests in the same time. Figure 1.2. Median JavaScript requests per page. With script requests, the stakes are higher. The more requests you send, the more JavaScript you load—and the more likely you’ll trigger a bottleneck as these scripts compete for attention on the main thread. This battle for resources can grind performance to a crawl, delaying startup and leaving users waiting. In 2024, the median mobile page is making 22 JavaScript requests, while those in the 90th percentile soar to 68. This represents a subtle yet notable increase of one request at the median and four at the 90th percentile compared to last year. On the desktop front, the story is similar: the median jumps to 23 JavaScript requests, with the 90th percentile climbing to 70 requests. Again, we see an increase of one request at the median and five at the 90th percentile—echoing the trends we observe in mobile. While these increases might appear modest at first glance, they signal a continuing evolution in web-behavior. Since the Web Almanac’s inception in 2019, we’ve witnessed a steady rise in JavaScript requests, hinting at a future where growth may substantially outpace performance improvements to counteract this. What will this mean for developers and users alike as we navigate the complexities of an increasingly JavaScript-heavy web? Bar chart showing unused JavaScript byes by percentile. On desktop it’s 21 kilobytes at the 10th perccentile, 87 at the 25th, 235 at the median, 509 at the 75th, and 923 at the 90th percentile. On mobile it’s 0 kilobytes at the 10th percentile, 74 at the 25th, 206 at the median, 450 at the 75th and 818 kilobytes 90th percentile. Figure 1.3. Distribution of unused JavaScript. Along with this increase in JavaScript, we see an increase in unused bytes of JavaScript with approximately half the bytes downloaded being unused during page load (206 kilobytes—or 44% of bytes delivered—at the media on mobile). ## How is JavaScript packaged processed? JavaScript bundling and transpiling have transformed web development by optimizing how applications are built and delivered. Bundlers like webpack and Parcel package multiple files into a single bundle, reducing HTTP requests and improving loading times. Transpilers like Babel allow developers to use modern JavaScript features while ensuring compatibility across various browsers. However, managing these processes is crucial to avoid larger payloads that can hinder performance. Ultimately, they strike a balance between innovation and user experience, ensuring powerful yet efficient applications. ### Bundlers JavaScript bundlers, like webpack and Parcel, package multiple JavaScript files into a single bundle to streamline delivery to users. They analyze the code and its dependencies, optimizing the final output to reduce the number of HTTP requests. By combining files, bundlers can improve loading times and performance. However, these tools can sometimes unintentionally tangle functional code with user tracking scripts, complicating performance and privacy considerations. Bar chart showing webpack usage by rank. For desktop it’s 15% for the top 1,000 sites, 17% for the top 10,000, 13% for the top 100,000, 9% for the top one million, 6% for the top 10 million, and 6% for all sites. For mobile it’s 13% for the top 1,000 sites, 16% for the top 10,000, 13% for the top 100,000, 9% for the top million, and 5% for the top ten million and 5% for all sites. Figure 1.4. Sites using webpack grouped by rank. While webpack usage remains at a steady 5% across websites, recent trends reveal a decline in its adoption among the top 1,000 sites, both on mobile and desktop. Although 5% may seem modest, it still represents a substantial number of Web Almanac’s sites. Bar chart showing Parcel usage by rank. For desktop it’s 0.32% for the top 1,000 sites, 0.40% for the top 10,000, 0.51% for the top 100,000, 0.65% for the top one million, 0.54% for the top 10 million, and 0.49% for all sites. For mobile it’s 0.26% for the top 1,000 sites, 0.28% for the top 10,000, 0.43% for the top 100,000, 0.58% for the top million, and 0.44% for the top ten million and 0.34% for all sites. Figure 1.5. Sites using Parcel grouped by rank. Parcel stands as the second most popular alternative to webpack, boasting a notable adoption rate among developers. However, recent trends indicate a decline in its usage, dropping from 1.3% of mobile websites last year to just 0.3% this year. A similar pattern emerges on desktop platforms, reflecting a shift in the landscape of JavaScript bundlers. ### Transpilers In the 2022 Web Almanac, year we [looked at transpilers as a percentage of those sites with available source maps](../2022/javascript#transpilers). This year, we’ve changed to the percentage of overall sites. This methodology change means we’re moving from a likely over counting of sites (sites using sourcemaps are, by definition, more likely to more complex web applications than need transpilation), to an under counting (as not all sites publish public source maps). Bar chart showing Babel usage by rank. For desktop it’s 7.6% for the top 1,000 sites, 8.9% for the top 10,000, 6.9% for the top 100,000, 4.7% for the top one million, 4.1% for the top 10 million, and 5.3% for all sites. For mobile it’s 9.9% for the top 1,000 sites, 12.0% for the top 10,000, 9.1% for the top 100,000, 5.8% for the top million, and 4.7% for the top ten million and 6.1% for all sites. Figure 1.6. Sites using Babel grouped by rank. Babel is particularly prevalent among higher-ranked websites, with 12% of the top 10,000 mobile sites using Babel (and this is 23% - 38% of sites using source maps, so similar to [last year’s Babel results](../2022/javascript#fig-6)). Mobile sites consistently show higher adoption rates than desktop sites, regardless of rank. These trends highlight Babel’s prominence, especially among top-tier and mobile-optimized sites, indicating its growing importance in modern web development. #### How often is TypeScript used? TypeScript is a superset of JavaScript that adds static types, which help catch errors during development and make the code more maintainable. These tools streamline the development process and ensure cross-browser compatibility. Bar chart showing Babel usage by rank. For desktop it’s 5.2% for the top 1,000 sites, 6.7% for the top 10,000, 6.1% for the top 100,000, 5.5% for the top one million, 4.9% for the top 10 million, and 6.0% for all sites. For mobile it’s 4.5% for the top 1,000 sites, 6.2% for the top 10,000, 5.7% for the top 100,000, 5.4% for the top million, and 4.9% for the top ten million and 6.2% for all sites. Figure 1.7. Sites using TypeScript grouped by rank. Across all ranks, around 6% of pages use TypeScript, with mobile generally having slightly higher adoption. Again, this only counts sites publishing sourcemaps. The usage is fairly consistent, though top-ranked pages (1,000) show slightly lower TypeScript adoption compared to lower-ranked ones. ## How is JavaScript requested? In the fast-paced world of web development, the way JavaScript is loaded can make or break a site’s performance. From synchronous loading that can slow page rendering to asynchronous techniques that boost speed, developers have a range of options at their disposal. The challenge lies in balancing the power of JavaScript’s interactivity with the need for swift, seamless user experiences. By mastering optimal loading strategies, web creators can significantly enhance their sites’ responsiveness and user satisfaction. ### `async`, `defer`, `module`, and `nomodule` When optimizing JavaScript loading, developers have several powerful attributes at their disposal. The `async` attribute allows scripts to load asynchronously while HTML parsing continues, executing them as soon as they’re available. In contrast, `defer` postpones script execution until after HTML parsing is complete, maintaining the order of deferred scripts. For modern web applications, the `module` attribute indicates that a script is a JavaScript module, enabling ES6 import/export syntax and strict mode by default. Complementing this, the `nomodule` attribute specifies fallback scripts for browsers that don’t support ES6 modules, ensuring broader compatibility while allowing modern browsers to ignore these fallbacks. By strategically employing these attributes, developers can fine-tune script loading behavior to optimize page performance and user experience. Bar chart showing that on desktop, `async` is used on 87% of sites, `defer` on 48%, `async` and `defer` on 22%, `module` on 4%, `nomodule` at 0%, and neither `async` nor `defer` at 11%. For mobile it’s pretty identical: `async` is used on 87% of sites, `defer` on 47%, `async` and `defer` on 22%, `module` on 4%, `nomodule` at 0%, and neither `async` nor `defer` at 11%. Figure 1.8. How is JavaScript requested?. Comparing JavaScript loading trends from [the last Web Almanac 2022](../javascript/#async-defer-module-and-nomodule) to 2024 reveals notable shifts in developer practices. The use of the `async` attribute has increased significantly, from 76% to 87% of pages on both desktop and mobile. The `defer` attribute usage has seen a modest increase from 42% to 47%. The combination of `async` and `defer` attributes has decreased slightly from 28-29% to 22%, possibly due to developers choosing one method over the other. `module` usage remains low at 4%, while `nomodule` shows xlose to zero adoption, indicating that modern JavaScript module systems are still not widely implemented across the web. | Attribute | 2022 | 2024 | % change | | --- | --- | --- | --- | | `async` | 47.2% | 49.5% | 4.8% | | `defer` | 9.1% | 13.0% | 43.3% | | `async` and `defer` | 3.1% | 3.0% | -3.0% | | `module` | 0.4% | 1.2% | 208.8% | | `nomodule` | 0.0% | 0.0% | N/A | Figure 1.9. JavaScript requests by script (mobile). Comparing the trends on `