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

**URL:** <https://forum.ionicframework.com/t/ionic-serve-using-production-environment-which-i-dont-want/172571>\
**Category:** Ionic Framework\
**Created:** [September 5, 2019, 1:01pm UTC](https://forum.ionicframework.com/t/ionic-serve-using-production-environment-which-i-dont-want/172571 "2019-09-05T13:01:46Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Tommertom](https://avatars.discourse-cdn.com/v4/letter/t/ed8c4c/32.png) [@Tommertom](https://forum.ionicframework.com/u/Tommertom)\
**Post date:** [September 5, 2019, 1:01pm UTC](https://forum.ionicframework.com/t/ionic-serve-using-production-environment-which-i-dont-want/172571/1 "2019-09-05T13:01:46Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Tommertom](https://avatars.discourse-cdn.com/v4/letter/t/ed8c4c/32.png) [@Tommertom](https://forum.ionicframework.com/u/Tommertom)\
**Post date:** [September 13, 2019, 7:54am UTC](https://forum.ionicframework.com/t/ionic-serve-using-production-environment-which-i-dont-want/172571/2 "2019-09-13T07:54:19Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Tommertom](https://avatars.discourse-cdn.com/v4/letter/t/ed8c4c/32.png) [@Tommertom](https://forum.ionicframework.com/u/Tommertom)\
**Post date:** [September 13, 2019, 12:22pm UTC](https://forum.ionicframework.com/t/ionic-serve-using-production-environment-which-i-dont-want/172571/3 "2019-09-13T12:22:58Z")

</div>

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 🙂  
Tom
