Skip to content

Neither baseHref nor APP_BASE_HREF is working with @angular-devkit/build-angular:browser-esbuild #25128

@paoyuan

Description

@paoyuan

Which @angular/* package(s) are the source of the bug?

Don't known / other

Is this a regression?

Yes

Description

  1. Using @angular-devkit/build-angular:browser-esbuild as local dev server
$ npm run start
> admin@0.0.0 start
> ng serve --hmr

The esbuild-based browser application builder ('browser-esbuild') is currently in developer preview and is not yet recommended for production use. For additional information, please see https://angular.io/guide/esbuild
The 'namedChunks' option is not used by this builder and will be ignored.
The 'vendorChunk' option is not used by this builder and will be ignored.

Initial Chunk Files         | Names         |  Raw Size
main.js                     | main          |   5.40 MB |
styles.css                  | styles        | 209.57 kB |
polyfills.js                | polyfills     |  82.84 kB |

                            | Initial Total |   5.69 MB

Lazy Chunk Files            | Names         |  Raw Size
es-CPQ26IB7.js              | -             |   1.62 MB |
sweetalert2.all-WWJX4NJH.js | -             | 123.48 kB |
sweetalert2-J65NCXNT.js     | -             | 102.88 kB |
chunk-XLBCT3LY.js           | -             |   3.02 kB |

Application bundle generation complete. [23.510 seconds]
  ➜  Local:   http://localhost:4200/
Watch mode enabled. Watching for file changes...
  1. open http://localhost:4200/ or http://localhost:4200/admin will be blank page

  2. Also tried APP_BASE_HREF but failed
    {
    provide: APP_BASE_HREF,
    useValue: '/admin'
    }

Please provide a link to a minimal reproduction of the bug

No response

Please provide the exception or error you saw

Watch mode enabled. Watching for file changes...
Failed to load url /admin/assets/js/bootstrap.bundle.min.js (resolved id: /admin/assets/js/bootstrap.bundle.min.js). Does the file exist?
Failed to load url /admin/assets/js/bootstrap.bundle.min.js (resolved id: /admin/assets/js/bootstrap.bundle.min.js). Does the file exist? (x2)

Please provide the environment you discovered this bug in (run ng version)

Angular CLI: 16.0.0
Node: 18.16.0
Package Manager: npm 7.17.0
OS: win32 x64

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

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1600.0
@angular-devkit/build-angular   16.0.0
@angular-devkit/core            16.0.0
@angular-devkit/schematics      16.0.0
@schematics/angular             16.0.0
rxjs                            6.6.7
typescript                      5.0.4

Anything else?

No response

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