chihab / dotenv-run

Seamlessly load environment variables. Supports cli, esbuild, rollup, vite, webpack, angular. ESM and Monorepos.
238 stars 17 forks source link

ng serve does not detect file changes automatically #101

Closed eak006 closed 1 month ago

eak006 commented 1 month ago

Thank you for this wonderful dependency!

Unfortunately, after adding this dependency today with ng add @ngx-env/builder, I switched my builder from "@angular-devkit/build-angular:application" to "@ngx-env/builder:application" and now ng serve ... doesn't detect file changes automatically after making a change to a typescript file.

I tried all the solutions here

"dependencies": {
    "@angular/animations": "^17.3.0",
    "@angular/cdk": "^17.3.10",
    "@angular/common": "^17.3.0",
    "@angular/compiler": "^17.3.0",
    "@angular/core": "^17.3.0",
    "@angular/forms": "^17.3.0",
    "@angular/material": "^17.3.10",
    "@angular/platform-browser": "^17.3.0",
    "@angular/platform-browser-dynamic": "^17.3.0",
    "@angular/router": "^17.3.0",
    "aws-sdk": "^2.1659.0",
    "rxjs": "~7.8.0",
    "tslib": "^2.3.0",
    "zone.js": "~0.14.3"
  },
  "devDependencies": {
    "@angular-devkit/build-angular": "^17.3.7",
    "@angular/cli": "^17.3.7",
    "@angular/compiler-cli": "^17.3.0",
    "@ngx-env/builder": "^18.0.1",
    "@types/jasmine": "~5.1.0",
    "jasmine-core": "~5.1.0",
    "karma": "~6.4.0",
    "karma-chrome-launcher": "~3.2.0",
    "karma-coverage": "~2.2.0",
    "karma-jasmine": "~5.1.0",
    "karma-jasmine-html-reporter": "~2.1.0",
    "typescript": "~5.4.2"
  }
eak006 commented 1 month ago

Hmmm... I tested out this GitHub repo and the problem doesn't exist anymore:

Watch mode enabled. Watching for file changes...
NOTE: Raw file sizes do not reflect development server per-request transformations.

I wonder what's up with my repository...

eak006 commented 1 month ago

Fixed. Had to update ng to version 18 with the commands in the rightmost column:

 @angular/cdk                       17.3.10 -> 18.1.0        ng update @angular/cdk
 @angular/cli                       17.3.7 -> 18.1.0         ng update @angular/cli
 @angular/core                      17.3.8 -> 18.1.0         ng update @angular/core
 @angular/material                  17.3.10 -> 18.1.0        ng update @angular/material