Skip to content

Migrating to new "application" builder does not allow for optional index file. #26905

@davebednarski

Description

@davebednarski

Command

build

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

16

Description

Issue:
If you do the ESbuild migration from browser build to application build you get an error while running "ng build" saying it cannot read index HTML file. In special setups that don't yet have this index.html, this was ok since you could leave that configuration empty and it would build. How this worked is you would manually add your build files paths to your project and the app's final dynamic html file would have them as srcs to download like usual. Now, whether the "index" config is empty or removed it fails to build.

Minimal Reproduction

Repro:

  1. Start with existing v16 project.
    1. Builder should be this: "builder": "@angular-devkit/build-angular:browser"
    2. To emulate a semi-custom build, the angular.json should have "index": "",
  2. Migrate the core to v17
  3. Migrate builder from browser to application
    1. Follow instructions here: https://angular.io/guide/esbuild#using-the-application-builder
    2. Builder should looks like this now: "builder": "@angular-devkit/build-angular:application",
  4. Run ng build

Actual:

  • An unhandled exception occurred: Failed to read index HTML file "project/src".

Expected:

  • Should build without errors since it was able to do so previously while not having an index.html file.

Exception or Error

An unhandled exception occurred: Failed to read index HTML file "project/src".

Your Environment

Angular CLI: 17.1.0
Node: 18.17.0
Package Manager: npm 9.6.7
OS: darwin x64

Angular: 17.1.0
... animations, cdk, cli, common, compiler, compiler-cli, core
... forms, language-service, material, platform-browser
... platform-browser-dynamic, router

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1701.0
@angular-devkit/build-angular   17.1.0
@angular-devkit/core            17.1.0
@angular-devkit/schematics      17.1.0
@schematics/angular             17.1.0
rxjs                            7.8.1
typescript                      5.3.3
zone.js                         0.14.3

Anything else relevant?

No response

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