{"id":302140,"date":"2020-01-24T14:35:05","date_gmt":"2020-01-24T21:35:05","guid":{"rendered":"https:\/\/css-tricks.com\/?p=302140"},"modified":"2020-01-25T21:13:40","modified_gmt":"2020-01-26T04:13:40","slug":"bundling-javascript-for-performance-best-practices","status":"publish","type":"post","link":"https:\/\/css-tricks.com\/bundling-javascript-for-performance-best-practices\/","title":{"rendered":"Bundling JavaScript for Performance: Best Practices"},"content":{"rendered":"\n

Performance advice<\/a> from David Calhoun on how many scripts to load on a page for best performance:<\/p>\n\n\n\n

[…] some of your vendor dependencies probably change slower than others. react<\/code> and react-dom<\/code> probably change the slowest, and their versions are always paired together, so they both form a logical chunk that can be kept separate from other faster-changing vendor code:<\/p><\/blockquote>\n\n\n\n\n\n\n\n

<script src=\"vendor.react.[hash].min.js\"><\/script>\n<script src=\"vendor.others.[hash].min.js\"><\/script>\n<script src=\"index.[hash].min.js\"><\/script><\/code><\/pre>\n\n\n\n

Funny how times haven’t changed that much! Me, in 2012, talking about how many CSS files need to be loaded on any given page: One, Two, or Three<\/a>. I split it into global, section-specific, and-page-specific so it was less about third-party code, although that could certainly apply, too. <\/p>\n","protected":false},"excerpt":{"rendered":"

Performance advice from David Calhoun on how many scripts to load on a page for best performance: […] some of your vendor dependencies probably change slower than others. react and react-dom probably change the slowest, and their versions are always paired together, so they both form a logical chunk that can be kept separate from other faster-changing vendor code:<\/p>\n","protected":false},"author":3,"featured_media":302167,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_bbp_topic_count":0,"_bbp_reply_count":0,"_bbp_total_topic_count":0,"_bbp_total_reply_count":0,"_bbp_voice_count":0,"_bbp_anonymous_reply_count":0,"_bbp_topic_count_hidden":0,"_bbp_reply_count_hidden":0,"_bbp_forum_subforum_count":0,"sig_custom_text":"","sig_image_type":"featured-image","sig_custom_image":0,"sig_is_disabled":false,"inline_featured_image":false,"c2c_always_allow_admin_comments":false,"footnotes":"","jetpack_publicize_message":"","jetpack_is_tweetstorm":false,"jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":[]},"categories":[17],"tags":[],"jetpack_publicize_connections":[],"acf":[],"jetpack_featured_media_url":"https:\/\/i0.wp.com\/css-tricks.com\/wp-content\/uploads\/2020\/01\/react-versions.png?fit=1200%2C600&ssl=1","jetpack-related-posts":[{"id":265215,"url":"https:\/\/css-tricks.com\/react-perf-devtool\/","url_meta":{"origin":302140,"position":0},"title":"react-perf-devtool","date":"January 10, 2018","format":false,"excerpt":"Here\u2019s an interesting and super useful Chrome extension by Nitin Tulswani that measures React component performance: React Performance Devtool is a browser extension for inspecting the performance of React Components. It statistically examines the performance of React components based on the measures which are collected by React using window.performance API.\u2026","rel":"","context":"In "Link"","img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":318461,"url":"https:\/\/css-tricks.com\/radeventlistener-a-tale-of-client-side-framework-performance\/","url_meta":{"origin":302140,"position":1},"title":"radEventListener: a Tale of Client-side Framework Performance","date":"August 18, 2020","format":false,"excerpt":"React is popular, popular enough that it receives its fair share of criticism. Yet, this criticism of React isn\u2019t completely unwarranted: React and ReactDOM total about 120 KiB of minified JavaScript, which definitely contributes to slow startup time. When client-side rendering in React is relied upon entirely, it churns. Even\u2026","rel":"","context":"In "Article"","img":{"alt_text":"","src":"https:\/\/i0.wp.com\/css-tricks.com\/wp-content\/uploads\/2020\/08\/react-hydration.devtools.png?fit=1200%2C600&ssl=1&resize=350%2C200","width":350,"height":200},"classes":[]},{"id":240999,"url":"https:\/\/css-tricks.com\/comparison-animation-technologies\/","url_meta":{"origin":302140,"position":2},"title":"A Comparison of Animation Technologies","date":"May 2, 2016","format":false,"excerpt":"The question I am asked most frequently: what animation tool do you recommend? Having worked with a slew of them, I can tell you there is no right answer. It's a complicated question and complicated answer. This post serves to clarify what to use, and when, to get you working\u2026","rel":"","context":"In "Article"","img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":312407,"url":"https:\/\/css-tricks.com\/analyzing-notion-app-performance\/","url_meta":{"origin":302140,"position":3},"title":"Analyzing Notion app performance","date":"June 8, 2020","format":false,"excerpt":"Here\u2019s a fantastic case study where Ivan Akulov looks at the rather popular writing app Notion and how the team might improve the performance in a variety of ways; through code splitting, removing unused vendor code, module concatenation, and deferring JavaScript execution. Not so long ago, we made a list\u2026","rel":"","context":"In "Link"","img":{"alt_text":"","src":"https:\/\/i0.wp.com\/css-tricks.com\/wp-content\/uploads\/2020\/06\/notion.png?fit=1200%2C790&ssl=1&resize=350%2C200","width":350,"height":200},"classes":[]},{"id":340705,"url":"https:\/\/css-tricks.com\/a-thorough-analysis-of-css-in-js\/","url_meta":{"origin":302140,"position":4},"title":"A Thorough Analysis of CSS-in-JS","date":"May 26, 2021","format":false,"excerpt":"Wondering what\u2019s even more challenging than choosing a JavaScript framework? You guessed it: choosing a CSS-in-JS solution. Why? Because there are more than 50 libraries out there, each of them offering a unique set of features. We tested 10 different libraries, which are listed here in no particular order: Styled\u2026","rel":"","context":"In "Article"","img":{"alt_text":"","src":"https:\/\/i0.wp.com\/css-tricks.com\/wp-content\/uploads\/2021\/05\/kwyuFPAdFlkMaYo7vYFufdUG3WP4mp7_bbAsQnU7sVCnGH31dDmSgYp5KHqX4tQQR60KfzWV890kBXDPC68H4rLuYvMeVEhItg_oBFt59mCJmsN8giiB6HogBD9F7h6p2aMbs7Q.png?fit=1200%2C674&ssl=1&resize=350%2C200","width":350,"height":200},"classes":[]},{"id":311360,"url":"https:\/\/css-tricks.com\/the-modern-web\/","url_meta":{"origin":302140,"position":5},"title":"“The Modern Web”","date":"May 22, 2020","format":false,"excerpt":"A couple of interesting articles making the rounds: Tom MacWrite: Second-guessing the modern webRich Harris: In defense of the modern web I like Tom's assertion that React (which he's using as a stand-in for JavaScript frameworks in general) has an ideal usage: There is a sweet spot of React: in\u2026","rel":"","context":"In "Article"","img":{"alt_text":"","src":"https:\/\/i0.wp.com\/css-tricks.com\/wp-content\/uploads\/2019\/08\/website-lightning.png?fit=1200%2C600&ssl=1&resize=350%2C200","width":350,"height":200},"classes":[]}],"featured_media_src_url":"https:\/\/i0.wp.com\/css-tricks.com\/wp-content\/uploads\/2020\/01\/react-versions.png?fit=1024%2C512&ssl=1","_links":{"self":[{"href":"https:\/\/css-tricks.com\/wp-json\/wp\/v2\/posts\/302140"}],"collection":[{"href":"https:\/\/css-tricks.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/css-tricks.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/css-tricks.com\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/css-tricks.com\/wp-json\/wp\/v2\/comments?post=302140"}],"version-history":[{"count":5,"href":"https:\/\/css-tricks.com\/wp-json\/wp\/v2\/posts\/302140\/revisions"}],"predecessor-version":[{"id":302679,"href":"https:\/\/css-tricks.com\/wp-json\/wp\/v2\/posts\/302140\/revisions\/302679"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/css-tricks.com\/wp-json\/wp\/v2\/media\/302167"}],"wp:attachment":[{"href":"https:\/\/css-tricks.com\/wp-json\/wp\/v2\/media?parent=302140"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/css-tricks.com\/wp-json\/wp\/v2\/categories?post=302140"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/css-tricks.com\/wp-json\/wp\/v2\/tags?post=302140"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}