Function isOnProduction

  • Determines if the current environment is production based on the window location hostname.

    Returns boolean

    • Returns true if the environment is production, otherwise false.
    // Assuming the window location hostname is 'production.example.com'
    const isProduction = isOnProduction();
    console.log(isProduction); // true or false based on the hostname

    This function checks if the code is running in a browser environment by verifying if window is defined. If window is defined, it compares the current hostname with predefined production hostnames (PWA_HOST and SITE_HOST). If window is not defined (e.g., in a Node.js environment), it defaults to returning true.