Skip to content

esbuild watch mode keeps detecting changes and rebuilding #24936

@PaulvdDool

Description

@PaulvdDool

Command

serve

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

No response

Description

I've been trying to switch our project to the experimental esbuild in a hope to get our build times down from ~3 minutes.

I've added an extra architect option to our angular.json file.

        "esbuild": {
          "builder": "@angular-devkit/build-angular:browser-esbuild",
          "options": {
            "outputPath": "dist/",
            "index": "src/client/dummy.html",
            "main": "src/client/index.ts",
            "polyfills": "src/client/polyfills.ts",
            "tsConfig": "tsconfig.json",
            "inlineStyleLanguage": "scss",
            "assets": [
              "src/client/assets"
            ],
            "scripts": []
          },
          "configurations": {
            "development": {
              "buildOptimizer": false,
              "optimization": false,
              "vendorChunk": true,
              "extractLicenses": false,
              "sourceMap": true,
              "namedChunks": true
            }
          },
          "defaultConfiguration": "development"
        },

I then run this particular configuration with ng run core:esbuild --watch.

It builds fine in about 90-100 seconds in the first attempt, but after an initial change, the file watcher keeps on seeing a change and will try to rebuild.

Complete. [8.351 seconds]
Changes detected. Rebuilding...

It will even start doing this if you build initially and wait long enough.

I've tried to create a test case by creating a new Angular project and adding the same changes to angular.json, but there the filewatcher works fine and only builds once after a change.

I'm wondering what it could be that keeps triggering these file changes.

Minimal Reproduction

As described above:

  1. added architect option to angular.json file with experimental esbuild pipeline
  2. run particular configuration with ng run core:esbuild --watch

Exception or Error

No response

Your Environment

_                      _                 ____ _     ___
    / \   _ __   __ _ _   _| | __ _ _ __     / ___| |   |_ _|
   / △ \ | '_ \ / _` | | | | |/ _` | '__|   | |   | |    | |
  / ___ \| | | | (_| | |_| | | (_| | |      | |___| |___ | |
 /_/   \_\_| |_|\__, |\__,_|_|\__,_|_|       \____|_____|___|
                |___/
    

Angular CLI: 15.2.4
Node: 16.13.0
Package Manager: npm 8.1.0
OS: darwin x64

Angular: 15.2.5
... animations, common, compiler, compiler-cli, core, forms
... language-service, localize, platform-browser
... platform-browser-dynamic, platform-server, router

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1303.10
@angular-devkit/build-angular   15.2.4
@angular-devkit/core            15.2.4
@angular-devkit/schematics      13.3.10
@angular/cdk                    12.2.13
@angular/cli                    15.2.4
@schematics/angular             15.2.4
ng-packagr                      15.2.2
rxjs                            6.6.7
typescript                      4.9.5

Anything else relevant?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions