Ionic serve using production environment - which I don't want

Hi,

when I run ionic serve -w chrome, it uses environment.prod.ts instead of environment.ts

I tried tweaking in angular.json, the part of fileReplacements in configuration to see if that is part of the issue, but does not seem to be.

The “serve” part in angular.json shows a configuration,production key, but I assume that one is only triggered when using --prod flag (which I don’t use).

WHen I run ionic serve -w chrome --prod, it does show ng.cmd run app:serve:production --host=localhost --port=8100, (whereas without --prod it shows ng.cmd run app:serve --host=localhost --port=8100)

What am I doing wrong here? Any hints?

I am not very comfortable changing much of the scripts parts for a nearly production app, so any help will be appreciated.

Thx
Tom

Hi
in addition this, when i console.log in app.component.ts the environment it should the dev keys, but the subsequent page uses the prod keys…

How odd…

Anyone have a clue what I am doing here?

Regards

Tom

Found it!

While referencing to the environmnent object in the environment.ts file in a ts file, the auto-import used environment.prod.ts instead of environment.ts and as such there was no replacement…

Silly me.

How did I find out: by renaming environment.prod.ts and the see which part would complain.

Thanks for bearing with me :slight_smile:
Tom