Search code examples
angular-cliangular-cli-v7

What are the options set by default when we run ng build --prod


When I build my angular application with ng build --prod it creates a build for production environment with build optimization, tree-shaking etc.. If I want to make the same kind of build for development environment, what options needs to be passed with ng build command? Eg.,

ng build --configuration=development --aot --buildOptimizer=true --vendorChunk=false

Basically, what are the cli options one should pass, to make a dev build exactly similar to prod build(except the configuration)?


Solution

  • Other than the option you already used you should add:

    --outputHashing= all --sourceMap= false --extractCss=true --namedChunks= false --extractLicenses=true --optimization=true

    You can find here the list of all available options.

    If you check your angular.json file, under:

    "configurations": {
      "production": {
       // HERE all the used options by default for prod build
       }
    }
    

    You can read all the used options for a prod build.