Skip to content

asset path must start with the project source root #10883

@juristr

Description

@juristr

Versions

Angular CLI: 6.0.1
Node: 9.2.0
OS: darwin x64
Angular: 6.0.2
... animations, common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... router

Package                           Version
-----------------------------------------------------------
@angular-devkit/architect         0.6.1
@angular-devkit/build-angular     0.6.1
@angular-devkit/build-optimizer   0.6.1
@angular-devkit/core              0.6.1
@angular-devkit/schematics        0.6.1
@angular/cdk                      5.2.5
@angular/cli                      6.0.1
@angular/flex-layout              6.0.0-beta.15
@angular/material                 5.2.5
@ngtools/webpack                  6.0.1
@schematics/angular               0.6.1
@schematics/update                0.6.1
rxjs                              6.1.0
typescript                        2.7.2
webpack                           4.6.0

Repro steps

I have a nrwl/nx repository which I migrated. The Angular CLI update script migrated my .angular-cli.json in the following way (excerpt of one of the projects in my monorepo):

"securplan-web": {
    "root": "",
    "sourceRoot": "src",
    "projectType": "application",
    "architect": {
    "build": {
        "builder": "@angular-devkit/build-angular:browser",
        "options": {
        "outputPath": "dist/apps/securplan-web",
        "index": "apps/securplan-web/src/index.html",
        "main": "apps/securplan-web/src/main.ts",
        "tsConfig": "apps/securplan-web/src/tsconfig.app.json",
        "polyfills": "apps/securplan-web/src/polyfills.ts",
        "assets": ["apps/securplan-web/src/assets", "apps/securplan-web/src/favicon.ico"],
        "styles": ["apps/securplan-web/src/assets/style/material-icons.css", "apps/securplan-web/src/styles.scss"],
        "scripts": []
        },
       ...
    }
...
}

Note the assets configuration. If I try to build or serve this project I get the error

The apps/securplan-web/src/assets asset path must start with the project source root.

Changing the path from

 "assets": ["apps/securplan-web/src/assets", "apps/securplan-web/src/favicon.ico"],

to

"assets": ["assets", "favicon.ico"],

doesn't work and results in this error:

The assets asset path must start with the project source root.

What works is if I change it like this:

"assets": [
  { "input": "apps/securplan-web/src/assets", "glob": "**/*", "output": "assets" },
  { "input": "apps/securplan-web/src", "glob": "favicon.ico", "output": "." }
],

Observed behavior

(as described before in the repro steps)

Desired behavior

Although the "explicit" form of defining the assets paths works, the error message is very misleading and kinda strange, since my path is actually inside the project source root, especially when then changing it to "assets": ["assets", "favicon.ico"],

Mention any other details that might be useful (optional)

This might be related to #10688 although it's not exactly the same use case.

//cc FYI @clydin

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions