All you need to know about JavaScript code splitting

JavaScript code splitting

Modern sites often combine all of their JavaScript into a single, large main.js script. This regularly contains the scripts for all your pages or routes, even if users only need a small portion for the page they're viewing. 

When JavaScript is served this way, the loading performance of your web pages can suffer – especially with responsive web design on mobile devices. So let's fix it by implementing JavaScript code splitting (make sure you also see our selection of CSS and JavaScript tutorials).

Thank you for reading 5 articles this month* Join now for unlimited access

Enjoy your first month for just £1 / $1 / €1

*Read 5 free articles per month without a subscription

Join now for unlimited access

Try first month for just £1 / $1 / €1

Addy is an engineering manager with the Chrome team at Google. His day-to-day job is leading a speed team who are dedicated to making the web fast. Their projects include Lighthouse.