Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to tell if a web app uses code splitting

How can a web developer tell if a web app at a given URL is using code splitting, such as that provided by webpack, rollup or other libraries?

like image 532
Dan Dascalescu Avatar asked May 05 '17 07:05

Dan Dascalescu


People also ask

How does code splitting work?

Code splitting is the splitting of code into various bundles or components which can then be loaded on demand or in parallel. As an application grows in complexity or is maintained, CSS and JavaScripts files or bundles grow in byte size, especially as the number and size of included third-party libraries increases.

Does React support code splitting?

Code splitting is a way to split up your code from a large file into smaller code bundles. These can then be requested on demand or in parallel.

What is code splitting webpack?

Code splitting is one of the most compelling features of webpack. This feature allows you to split your code into various bundles which can then be loaded on demand or in parallel.


1 Answers

If using Google Chrome, you can take a look at the network tab of the developer tools.

If the application uses webpack code splitting, typically multiple JavaScript bundles are loaded, with hash codes for cache-busting added.

In the example below, there is a main JavaScript bundle postList.blabla243fe.js. This is loaded on page load. While the code is executed, another bundle 0.8a3dblabla.js is loaded asynchronously.

screenshot chrome dev tools network tab

like image 186
Patrick Hund Avatar answered Nov 15 '22 09:11

Patrick Hund