2 to 14 (TypeScript) with Angular CLI
OneTime Setup
npm install -g @angular/cling new projectFoldercreates a new application
Bundling Step
-
ng build(run in command line when directory isprojectFolder).flag
prodbundle for production is now the default (see the Angular documentation to customize it if needed). -
Compress using Brotli compression the resources using the following command
for i in dist/*/*; do brotli $i; done
bundles are generated by default to projectFolder/dist(/$projectFolder for v6+)**
Output
Sizes with Angular 14.0.2 with CLI 14.0.2and option CSS without Angular routing
dist/main.[hash].jsYour application bundled [ size: 118 KB for new Angular CLI application empty, 36 KB compressed].dist/polyfill-[es-version].[hash].bundle.jsthe polyfill dependencies (@angular, RxJS…) bundled [ size: 34 KB for new Angular CLI application empty, 11 KB compressed].dist/index.htmlentry point of your application.dist/runtime.[hash].bundle.jswebpack loaderdist/style.[hash].bundle.cssthe style definitionsdist/assetsresources copied from the Angular CLI assets configuration
Deployment
You can get a preview of your application using the ng serve --prod command that starts a local HTTP server such that the application with production files is accessible using http://localhost:4200. This is not safe to use for production usage.
For a production usage, you have to deploy all the files from the dist folder in the HTTP server of your choice.