Lazy Loading of Routes
We'll cover the following...
Let’s go inside our project and run npm start on the command line to see what all files it builds.
npm start
Now let’s take a close look at the files that have been built and try to understand what they are for.
The main.js
file contains all the code in our application, the polyfills.js
file loads all the polyfill scripts to make sure it is compatible with all the modern browsers. The runtime.js
loads all the other files. The styles.js
file loads the styles as the name suggests, and then the vendor.js
file loads all the imported libraries.
Also, have a look at the sizes of these files that we will compare with the production generated files.
Now lets us run our application in production mode using:
Use :
ng serve -o --prod
Look at the generated files now, they are less in number, and smaller in size too . Where did the ...