Last week, the Angular team announced the release of Angular CLI 3.8.0. Along with a redesigned website, this release comes with a new deploy command and improves previously introduced differential loading.
🔥 Angular CLI 8.3.0 is out and it has two brand new features!
🔸 Redesigned ng new app
🔸 ng deploy command
— Angular (@angular) August 22, 2019
Key updates in Angular CLI 8.3.0
Deploy directly from CLI to a cloud platform with the new deploy command
Starting from Angular CLI 8.3.0, you have a new deploy command to execute the deploy CLI builder associated with your project. It is essentially a simple alias to ng run MY_PROJECT:deploy.
There are many third-party builders that implement deployment capabilities to different platforms that you can add to your project with ng add [package name]. After this package with the deployment capability is added, your project’s angular.json file is automatically updated with a deploy section. You can then simply deploy your project by executing the ng deploy command.
Currently, the deploy command supports deployment to Firebase, Azure, Zeit, Netlify, and GitHub. You can also create a builder yourself to use the ng deploy command in case you are deploying to a self-managed server or there’s no builder for the cloud platform you are using.
Improved differential loading
Angular CLI 8.0 introduced the concept of differential loading to maximize browser compatibility of your web application. Most of the modern browsers today support ES2015, but there might be cases when your app users have a browser that doesn’t. To target a wide range of browsers, you can use polyfill scripts for the browsers.
You can ship a single bundle containing all your compiled code and any polyfills that may be needed. However, this increased bundle size shouldn’t affect users who have modern browsers. This is where differential loading comes in where the CLI builds two separate bundles as part of your deployed application. The first bundle will target modern browsers, while the second one will target the legacy browser with all necessary polyfills.
Though this increases your application’s browser compatibility, the production build ends up taking twice the time. Angular CLI 8.3.0 fixes this by changing how the command runs. Now, the build targeting ES2015 is built first and then it is directly down leveled to ES5, instead of rebuilding the app from scratch. In case you encounter any issue, you can fall back to the previous behavior with NG_BUILD_DIFFERENTIAL_FULL=true ng build –prod.
Many Angular developers are excited about the new updates in Angular CLI 8.3.0.
Also visible is the faster differential(ES6/ES5) bundle building that builds everything only once as ES6 and downlevels that to ES5 instead of rebuilding everything from the beginning.
— Vikram (@vikerman) August 22, 2019
And I never expected the builder which is created for @Netlify will be on official docs one day, I got this idea while looking at GitHub deploy builder created by @mgechev and started it for my personal project. Thanks a lot @angular community.
— Santosh Yadav (@Santosh19742211) August 23, 2019
While some did question the usefulness of the deploy command. A developer on Reddit shared their perspective, “Honestly, I think Angular and the CLI are already big and complex enough. Every feature possibly creates bugs and needs to be maintained. While the CLI is incredibly useful and powerful there have been also many issues in the past. On the other hand, I must admit that I can’t judge the usefulness of this feature: I’ve never used Firebase. Is it really so hard to deploy on it? Can’t this be done with a couple of lines of a shell script? As already said: One should use CI/CD anyway.”
To know more in detail about the new features in Angular CLI 8.3.0, check out the official docs. Also, check out the @angular-schule/ngx-deploy-starter repository to create a new builder for utilizing the deploy command.