title: Build Angular Application for production
body: <p>Hello I am having great difficulty building my angular application for production. </p>
  
  <p>I am running the 'ng build --prod' command however when i open the 'dist' folder i don't see all my components there. Is there something else i have to change or configure? When opening the 'dist' folder i see some components.</p>
  
  <blockquote>
    <p><strong>angular.json</strong></p>
  </blockquote>
  
  <pre><code>{
     "$schema":"./node_modules/@angular/cli/lib/config/schema.json",
     "version":1,
     "newProjectRoot":"projects",
     "projects":{
        "app":{
           "projectType":"application",
           "schematics":{
              "@schematics/angular:component":{
                 "style":"scss"
              }
           },
           "root":"",
           "sourceRoot":"src",
           "prefix":"app",
           "architect":{
              "build":{
                 "builder":"@angular-devkit/build-angular:browser",
                 "options":{
                    "outputPath":"dist/app",
                    "index":"src/index.html",
                    "main":"src/main.ts",
                    "polyfills":"src/polyfills.ts",
                    "tsConfig":"tsconfig.app.json",
                    "aot":false,
                    "assets":[
                       "src/favicon.ico",
                       "src/assets",
                       "src/images"
                    ],
                    "styles":[
                       "src/styles.scss"
                    ],
                    "scripts":[
  
                    ]
                 },
                 "configurations":{
                    "production":{
                       "fileReplacements":[
                          {
                             "replace":"src/environments/environment.ts",
                             "with":"src/environments/environment.prod.ts"
                          }
                       ],
                       "optimization":true,
                       "outputHashing":"all",
                       "sourceMap":false,
                       "extractCss":true,
                       "namedChunks":false,
                       "aot":true,
                       "extractLicenses":true,
                       "vendorChunk":false,
                       "buildOptimizer":true,
                       "budgets":[
                          {
                             "type":"initial",
                             "maximumWarning":"2mb",
                             "maximumError":"5mb"
                          },
                          {
                             "type":"anyComponentStyle",
                             "maximumWarning":"6kb",
                             "maximumError":"10kb"
                          }
                       ]
                    }
                 }
              },
              "serve":{
                 "builder":"@angular-devkit/build-angular:dev-server",
                 "options":{
                    "browserTarget":"app:build"
                 },
                 "configurations":{
                    "production":{
                       "browserTarget":"app:build:production"
                    }
                 }
              },
              "extract-i18n":{
                 "builder":"@angular-devkit/build-angular:extract-i18n",
                 "options":{
                    "browserTarget":"app:build"
                 }
              },
              "test":{
                 "builder":"@angular-devkit/build-angular:karma",
                 "options":{
                    "main":"src/test.ts",
                    "polyfills":"src/polyfills.ts",
                    "tsConfig":"tsconfig.spec.json",
                    "karmaConfig":"karma.conf.js",
                    "assets":[
                       "src/favicon.ico",
                       "src/assets"
                    ],
                    "styles":[
                       "src/styles.scss"
                    ],
                    "scripts":[
  
                    ]
                 }
              },
              "lint":{
                 "builder":"@angular-devkit/build-angular:tslint",
                 "options":{
                    "tsConfig":[
                       "tsconfig.app.json",
                       "tsconfig.spec.json",
                       "e2e/tsconfig.json"
                    ],
                    "exclude":[
                       "**/node_modules/**"
                    ]
                 }
              },
              "e2e":{
                 "builder":"@angular-devkit/build-angular:protractor",
                 "options":{
                    "protractorConfig":"e2e/protractor.conf.js",
                    "devServerTarget":"app:serve"
                 },
                 "configurations":{
                    "production":{
                       "devServerTarget":"app:serve:production"
                    }
                 }
              }
           }
        }
     },
     "defaultProject":"app"
  }
  </code></pre>
  
  <blockquote>
    <p><strong>ts.config.json</strong></p>
  </blockquote>
  
  <pre><code>{
     "compileOnSave":false,
     "compilerOptions":{
        "baseUrl":"./",
        "outDir":"./dist/out-tsc",
        "sourceMap":true,
        "declaration":false,
        "downlevelIteration":true,
        "experimentalDecorators":true,
        "module":"esnext",
        "moduleResolution":"node",
        "importHelpers":true,
        "target":"es2015",
        "typeRoots":[
           "node_modules/@types"
        ],
        "lib":[
           "es2018",
           "dom"
        ]
     },
     "angularCompilerOptions":{
        "fullTemplateTypeCheck":true,
        "strictInjectionParameters":true
     }
  }
  </code></pre>
  
  <p>Output when running a new build:</p>
  
  <p><a href="https://i.stack.imgur.com/qt867.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/qt867.png" alt="enter image description here"></a></p>
  
  <p>I now get this error when run in the console locally:</p>
  
  <p>Failed to load resource: net::ERR_FILE_NOT_FOUND
  index.html:1 Access to script at 'file:///C:/polyfills-es2015.0fe6949bc5ff4b784062.js' from origin 'null' has been blocked by CORS policy: Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-extension, https.</p>