Skip to content

ignoring custom path in angular,json  #19629

@davidalc

Description

@davidalc

🐞 Bug report

Command (mark with an x)

  • new
  • build
  • serve
  • test
  • e2e
  • generate
  • add
  • update
  • lint
  • extract-i18n
  • run
  • config
  • help
  • version
  • doc

Is this a regression?

Yes, the previous version in which this bug was not present was: 10, 9, 8

Description

When changing the root of the project to a sub folder and changing the path of the main.ts, pollyfills and other files it ignores the config changes and it is looking for the files in their original location.

In earlier version it finds the files in the sub folder 'ProjectFolder' now it serches the files in the root folder 'myproject' and doesnt find them.

🔬 Minimal Reproduction

angular.json


{
  "$schema": "./node_modules/@angular/cli/lib/config/schema.json",
  "version": 1,
  "newProjectRoot": "projects",
  "projects": {
    "myproject": {
      "root": "ProjectFolder",
      "sourceRoot": "ProjectFolder/src",
      "projectType": "application",
      "prefix": "app",
      "schematics": {},
      "architect": {
        "build": {
          "builder": "@angular-devkit/build-angular:browser",
          "options": {
            "outputPath": "ProjectFolder/dist",
            "index": "ProjectFolder/src/index.html",
            "main": "ProjectFolder/src/main.ts",
            "polyfills": "ProjectFolder/src/polyfills.ts",
            "tsConfig": "tsconfig.app.json",
            "assets": [
              "ProjectFolder/src/favicon.ico",
              "ProjectFolder/src/assets"
            ],
            "styles": [
              "node_modules/primeicons/primeicons.css",
              "node_modules/primeng/resources/primeng.min.css",
              "node_modules/@angular/material/prebuilt-themes/deeppurple-amber.css",
              "ProjectFolder/src/styles/cstBootstrap.css",
              "ProjectFolder/src/styles/jquery-ui.theme.css",
              "ProjectFolder/src/styles/styles.css"
            ],
            "scripts": []
          },
          "configurations": {
            "production": {
              "fileReplacements": [
                {
                  "replace": "ProjectFolder/src/environments/environment.ts",
                  "with": "ProjectFolder/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"
                }
              ]
            }
          }
        },
        "serve": {
          "builder": "@angular-devkit/build-angular:dev-server",
          "options": {
            "browserTarget": "ProjectFolder:build"
          },
          "configurations": {
            "production": {
              "browserTarget": "ProjectFolder:build:production"
            }
          }
        },
        "extract-i18n": {
          "builder": "@angular-devkit/build-angular:extract-i18n",
          "options": {
            "browserTarget": "ProjectFolder:build"
          }
        },
        "test": {
          "builder": "@angular-devkit/build-angular:karma",
          "options": {
            "main": "ProjectFolder/src/test.ts",
            "polyfills": "ProjectFolder/src/polyfills.ts",
            "tsConfig": "tsconfig.spec.json",
            "karmaConfig": "karma.conf.js",
            "styles": [
              "ProjectFolder/src/styles.css"
            ],
            "scripts": [],
            "assets": [
              "src/favicon.ico",
              "src/assets"
            ]
          }
        },
        "lint": {
          "builder": "@angular-devkit/build-angular:tslint",
          "options": {
            "tsConfig": [
              "tsconfig.app.json",
              "tsconfig.spec.json"
            ],
            "exclude": [
              "**/node_modules/**"
            ]
          }
        }
      }
    },
    "YachadWeb-e2e": {
      "root": "e2e/",
      "projectType": "application",
      "prefix": "",
      "architect": {
        "e2e": {
          "builder": "@angular-devkit/build-angular:protractor",
          "options": {
            "protractorConfig": "ProjectFolder/e2e/protractor.conf.js",
            "devServerTarget": "ProjectFolder:serve"
          },
          "configurations": {
            "production": {
              "devServerTarget": "ProjectFolder:serve:production"
            }
          }
        },
        "lint": {
          "builder": "@angular-devkit/build-angular:tslint",
          "options": {
            "tsConfig": "e2e/tsconfig.e2e.json",
            "exclude": [
              "**/node_modules/**"
            ]
          }
        }
      }
    }
  },
  "defaultProject": "ProjectFolder",
  "cli": {
    "analytics": false
  }
}

running command


C:\projects\myproject> ng build --watch --delete-output-path=false --output-path=ProjectFolder/Pages

🔥 Exception or Error



Error: ENOENT: no such file or directory, open 'C:/projects/myproject/src/polyfills.ts'
    at Object.openSync (fs.js:476:3)
    at Object.readFileSync (fs.js:377:35)
    at NodeJSFileSystem.readFile (C:\projects\myproject\node_modules\@angular\compiler-cli\src\ngtsc\file_system\src\node_js_file_system.js:37:23)
    at EsmDependencyHost.DependencyHostBase.recursivelyCollectDependencies (C:\projects\myproject\node_modules\@angular\compiler-cli\ngcc\src\dependencies\dependency_host.js:81:40)
    at EsmDependencyHost.DependencyHostBase.processFile (C:\projects\myproject\node_modules\@angular\compiler-cli\ngcc\src\dependencies\dependency_host.js:136:22)
    at EsmDependencyHost.DependencyHostBase.collectDependenciesInFiles (C:\projects\myproject\node_modules\@angular\compiler-cli\ngcc\src\dependencies\dependency_host.js:56:26)
    at ProgramBasedEntryPointFinder.getInitialEntryPointPaths (C:\projects\myproject\node_modules\@angular\compiler-cli\ngcc\src\entry_point_finder\program_based_entry_point_finder.js:49:18)
    at ProgramBasedEntryPointFinder.TracingEntryPointFinder.findEntryPoints (C:\projects\myproject\node_modules\@angular\compiler-cli\ngcc\src\entry_point_finder\tracing_entry_point_finder.js:45:41)
    at C:\projects\myproject\node_modules\@angular\compiler-cli\ngcc\src\execution\analyze_entry_points.js:28:41
    at new ClusterMaster (C:\projects\myproject\node_modules\@angular\compiler-cli\ngcc\src\execution\cluster\master.js:45:30)

🌍 Your Environment


Angular CLI: 11.0.4
Node: 14.15.1
OS: win32 x64

Angular: 11.0.4
... animations, cli, common, compiler, compiler-cli, core, forms
... platform-browser, platform-browser-dynamic, router
Ivy Workspace: Yes

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1100.4
@angular-devkit/build-angular   0.1100.4
@angular-devkit/core            11.0.4
@angular-devkit/schematics      11.0.4
@schematics/angular             11.0.4
@schematics/update              0.1100.4
rxjs                            6.6.3
typescript                      4.0.5

Anything else relevant?
In earlier version it finds the files in the sub folder 'ProjectFolder' now it serches the files in the root folder 'myproject' and doesnt find them.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions