NG production Build

Open environment.prod.ts

export const environment = {
  production: true,
  apiUrl: 'api/'
};

Using visual studio code search for “localhost” to verify that we don’t have any harcoded paths.

We should only find environment.ts and app.module.ts in the JwtModule config (wich we can safely ignore).

Production build does the following optimizations:

  • AOT
  • production environment
  • bundling
  • minification
  • uglification
  • dead code elimination
ng build --prod

To avoid some problems with alertifyjs css we can disable the build optimizer. Not much is loss in terms of file size but the optimizer is very aggressive and can break some stuff.

ng build --prod --build-optimizer=false