How to check if Angular application running in Production or Development mode

前端 未结 6 608
挽巷
挽巷 2020-12-07 17:27

This seems an easy one, but I couldn\'t find any solution.

So, how do I check if my app is running in production mode or dev mode?

6条回答
  •  离开以前
    2020-12-07 17:46

    You should be careful that you check the return value of the isDevMode() function.

    My setup was failing because i was checking for existence: if (isDevMode) was always true, even in production because i declared it with import { isDevMode } from '@angular/core';.

    if (isDevMode()) returned false correctly.

提交回复
热议问题