Skip to content

CLI not properly setting the assets build property in a workspace #27709

Closed
@celestius0

Description

@celestius0

Command

generate

Is this a regression?

  • Yes, this behavior used to work in the previous version

The previous version in which this bug was not present was

17.3.8

Description

The v18 cli does not set the assets path properly for an application created inside a workspace. No dependencies other than @angular/cli@18.0.1. I suspect this may have something to do with the switch in syntax and folder name/location for the assets.

Expected Behavior

I would expect that the CLI would be workspace aware and properly set this value as it does with all the other config here that it generates.

Minimal Reproduction

Steps to Repro

  • Install the Angular CLI with npm i -g @angular/cli@18.0.1
  • Generate a new workspace with ng new some-workspace --no-create-application
  • cd into the newly created workspace with cd some-workspace
  • Generate a new application within this workspace with ng g app some-app

Note that the angular.json will be updated with an entry to include a configuration for this new application but in the projects > some-app > architect > build > options > assets array the object created there has public for the input property which does not appear to correctly reference the actual location of the public folder for this app.

Unexpected Behavior

The effect is that any assets placed in this folder will not be accessible when referenced, for example, in an <img> src attribute.

Workaround

Adjusting the application's assets configuration input property to projects/some-app/public appears to fix the issue.

Exception or Error

No response

Your Environment

Angular CLI: 18.0.1
Node: 22.2.0
Package Manager: npm 10.8.0
OS: linux x64

Angular: 18.0.0
... animations, common, compiler, compiler-cli, core, forms
... platform-browser, platform-browser-dynamic, router

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1800.1
@angular-devkit/build-angular   18.0.1
@angular-devkit/core            18.0.1
@angular-devkit/schematics      18.0.1
@angular/cli                    18.0.1
@schematics/angular             18.0.1
rxjs                            7.8.1
typescript                      5.4.5
zone.js                         0.14.6

Anything else relevant?

I'm guessing this issue is related to this commit and also appears to affect packages that rely on this folder to host assets such as @angular/pwa as well. Further, the relevant docs don't appear to reflect the current behavior of the project structure scaffolding (still references the old style of using an assets folder).

A related stack overflow can be found here which contains a little more detail about the issue I'm seeing.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions