Angular CLI serve re-compiles without change in source
Versions
Node: 6.11.3 OS: win32 x64 Angular: 5.1.3 ... animations, common, compiler, compiler-cli, core, forms ... http, platform-browser, platform-browser-dynamic ... platform-server, router
@angular/cdk: 5.0.4 @angular/cli: 1.6.3 @angular/language-service: 4.4.6 @angular/material: 5.0.4 @angular-devkit/build-optimizer: 0.0.36 @angular-devkit/core: 0.0.22 @angular-devkit/schematics: 0.0.42 @ngtools/json-schema: 1.1.0 @ngtools/webpack: 1.9.3 @schematics/angular: 0.1.11 @schematics/schematics: 0.0.11 typescript: 2.6.2 webpack: 3.10.0
Repro steps
ng serve -env=local
Observed behavior
- Sometimes re-compiles repeatedly without any source change
- After re-compiling like this a bunch of times, suddenly uses environment.ts instead of environment.local.ts - so then if my settings are respectively in environment.ts and environment.local.ts export const baseWebApiUrl = 'http://xxx:999/api/'; export const baseWebApiUrl = 'http://localhost:63037/api/'; Angular client tries to access web api at http://xxx:999/api/ .
local is just an example, It happens with env=dev too.
Desired behavior
Mention any other details that might be useful (optional)
When the problem happens I stop ng serve and then do ng build -env=local and then start ng serve -env=local again and things go fine until the problem again happens while re-compiling the wrong environment file is used
I'm also seeing the same thing (wrong environment file being used after a while, during ng serve). To be clear, what seems to happen is that ng serve launches using the correct environment file (e.g. environment.dev.ts), but after a few changes, it seems to switch over to the base environment.ts file.
This is using CLI 1.7.4 (haven't been able to update to 6 yet, due to some other libs not yet migrated to 6).
Heya, we're tracking this in https://github.com/angular/angular-cli/issues/11339 where there is more detail and a better repro case.
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.