Differential Loading in Angular
Angular is a complete javascript framework with many inbuilt features like routing, dependency injection, form validation but the downside is the application bundle size. In order to overcome this issue, Angular 8 introduces the concept of differential loading.
Until angular 7 versions, when we do an ng build command, the typescript files are converted into js files that can support both modern and old browsers. Since the build bundle should contain js files for new and old browsers, this results in huge bundle sizes.
With angular 8 Differential loading, when we do an ng build two different bundles are created one for modern browsers (supports recent syntax changes in JavaScript such as arrow functions in ES2015 or async functions in ES2017) and other for older browsers (es5 ex. IE)
When the app is deployed, both the bundles get deployed and based on the browser the clients opens the app from, the specific bundle gets loaded by the browser
Basically, Differential loading means to send newer, flashier code to modern browsers and stable legacy code to older browsers since old browsers need both transpiled code and more polyfills to make things work and newer browsers are not affected by the huge bundle size.
Comments
Post a Comment