Skip to content

Cannot use same target name in angular.json for multiple projects #12320

Closed
@EricABC

Description

@EricABC

Bug Report or Feature Request (mark with an x)

- [ X ] bug report

Command (mark with an x)

- [ X ] build
- [ X ] serve

Versions

7.0.0-beta.3 and 4.

Repro steps

Using an angular.json with multiple projects sharing the target name (ie, 'serve' and 'build' under the 'architect' node) will cause this error, even when specifying the project (ie. not a multiTarget). A recent change here caused this regression. It will give the error 'Could not determine a single project for the 'serve' target.' from within the call to getProjectNamesByTarget(), even though I have specified the project.

  "projects": {
    "stuff": {
      "architect": {
        "build": {

        }
      }
    },
    "morestuff": {
      "architect": {
        "build": {

The log given by the failure

Error: Could not determine a single project for the 'serve' target.
at ServeCommand.getProjectNamesByTarget (/Stuff/Spore/Typescript/node_modules/@angular/cli/models/architect-command.js:167:19)
at ServeCommand.initialize (/Stuff/Spore/Typescript/node_modules/@angular/cli/models/architect-command.js:75:39)
at process._tickCallback (internal/process/next_tick.js:68:7)
at Function.Module.runMain (internal/modules/cjs/loader.js:746:11)
at startup (internal/bootstrap/node.js:238:19)
at bootstrapNodeJSCore (internal/bootstrap/node.js:572:3)

Desired functionality

Ability to still use the same target names, 'build', 'serve', etc... across numerous projects in the same angular.json. A workaround is to use unique names.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions