JavaScript Edu Resources. Angular Courses. React Tutorials. Join us!

Building an Angular Application for Production

  • However, the bundle contains a bunch of useless content such as:

    In order to reduce the size of the bundle we can now use the script:

    It takes the file, and optimizes it.

  • Since we can’t apply tree-shaking directly over the original TypeScript files of our app, we’ll first need to transpile it to ES2015, after that create an ES2015 bundle by using rollup, and in the end transpile it to ES5.
  • Because of these changes in the flow of the build process, there’s a very important difference between the presented in the example above, and the one used in this section:

    Our target version here is in order to transpile the TypeScript application to an ES2015 one, with ES2015 modules.

  • Lets take a look at the file’s content:

    This is what the process of bootstrapping a precompiled (AoT compiled) app with Angular final is.

  • So, once we compile our app with , we want to move everything in the directory, and after that invoke the TypeScript compiler, in order to make it produce ES2015 code.

Building an Angular Application for Production – Minko Gechev’s blog