[Fixed] How do we exlude some folder in the root src folder when running ng build


In my application generated by angular-cli there is angular-cli.json file which control ng operations.

But how do we exclude some folder inside src which is specified in the root?

"apps": [{
        "root": "src",
        "outDir": "dist",
        "assets": [
        "index": "index.html",
        "main": "main.ts",
        "polyfills": "polyfills.ts",
        "test": "test.ts",
        "tsconfig": "tsconfig.app.json",
        "testTsconfig": "tsconfig.spec.json",
        "prefix": "app",
        "styles": [
        "scripts": [],
        "environmentSource": "environments/environment.ts",
        "environments": {
            "dev": "environments/environment.ts",
            "prod": "environments/environment.prod.ts"

Im thinking to add something like "exclude": [ "folder_name1", "folder_name1" ] but i cannot find any solution that agree in this.


ng-build will run tsc to compile target files, you can add exclude settings into tsconfig.app.json to exclude some specific files or folder.

  "compilerOptions": {
  "exclude": [
    "folder"    // example

Leave a Reply

(*) Required, Your email will not be published