Skip to content

Esbuild builder doesn't copy assets in watch mode #28415

Closed

Description

@PooSham

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

browser builder (webpack based)

Description

When running ng build --watch with either the build-esbuild or application builder, there is first a build step where everything is copied to the destination folder, including assets, but if a change is made to an asset after the initial bundle, then nothing happens. I'd expect the assets defined in the builders' "assets" option to also be updated during watch mode.

When I try the same in the webpack based "browser" builder, then everything is copied.

Minimal Reproduction

  • In angular.json, put the following inside "architect":
"build": {
    "builder": "@angular-devkit/build-angular:application",
    "options": {
        "assets": ["src/assets"],
        "index": "src/index.html",
        "browser": "src/main.ts",
        "outputPath": "dist",
        "tsConfig": "tsconfig.app.json"
    }
}
  • Make sure you have an index.html, main.ts and tsconfig.app.json.
  • Put some text file inside of src/assets.
  • Run ng build --watch.
  • Make a change to the text file inside the assets folder
  • Notice that the file hasn't been updated inside the dist folder

Exception or Error

No response

Your Environment

Angular CLI: 18.2.1
Node: 20.12.0
Package Manager: npm 10.5.0
OS: win32 x64

Angular: 18.2.1
... animations, cdk, cli, common, core, elements, forms
... language-service, platform-browser, platform-browser-dynamic
... router

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1802.1
@angular-devkit/build-angular   18.2.1
@angular-devkit/core            18.2.1
@angular-devkit/schematics      18.2.1
@schematics/angular             18.2.1
rxjs                            7.8.1
typescript                      5.5.4

Anything else relevant?

I have tried to dive into the Angular CLI source code, and I found that the watcher is given which files to watch here. I think the result comes from here, but it's a bit abstracted away and I can't easily find the source.

Activity

  1. added
    freq1: low
    on Sep 17, 2024
  2. PooSham commented on Nov 12, 2024

    @PooSham
    Author

    @alan-agius4 Any hope to get this fixed in 19.1, 19.2 or 20? I even pointed to relevant parts of the code under "Anything else relevant", so it should be a pretty quick fix.

  3. kyesil commented on Dec 14, 2024

    @kyesil

    Same issue angular/cli 19.0.5

  4. added 5 commits that reference this issue on Jan 7, 2025
    395e388
    6aa3e30
    74c93b8
    c60c60f
    14cc8fa
  5. self-assigned this
    on Jan 7, 2025
  6. added a commit that references this issue on Jan 7, 2025
    f752234
  7. added a commit that references this issue on Jan 7, 2025
    2f92121
  8. angular-automatic-lock-bot commented on Feb 7, 2025

    @angular-automatic-lock-bot

    This issue has been automatically locked due to inactivity.
    Please file a new issue if you are encountering a similar or related problem.

    Read more about our automatic conversation locking policy.

    This action has been performed automatically by a bot.

  9. locked and limited conversation to collaborators on Feb 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

angular/build:applicationarea: @angular/buildfreq1: lowseverity3: broken

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions