How it works…

We will use the web developer tools to look at the network transfers. When we start the application, we get the home page and just a few transfers, including bundle.js, the main source block. This is the file that will grow heavily in size as your application becomes larger. See the following screenshot:

The initial load of the page shows that only bundle.js was sent over the net

If we click on a link, the corresponding chunk of split code will be transferred. After accessing several of the links, you'd get something like the following:

 As you go to different links, chunks will get loaded, but only as needed

Even if our example is really tiny, you can see that you could easily partition the application to work in several smaller chunks. We can give no rules to suggest when you should start applying this technique, but, as we've seen, changing any component into an asynchronously loaded equivalent takes little effort, so you could start using the technique, even with all of your application already written.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.220.16.184