Skip to content

REACT_APP_ENV is undefined in mobile build #1557

@jemantilla

Description

@jemantilla

Describe the bug
Browser works well but when i create a mobile build it is undefined.

My ionic info:

Ionic:

   Ionic CLI       : 6.10.1 (/Users/neil/.nvm/versions/node/v10.16.3/lib/node_modules/@ionic/cli)
   Ionic Framework : @ionic/react 5.0.7

Capacitor:

   Capacitor CLI   : 2.2.1
   @capacitor/core : 2.3.0

Utility:

   cordova-res : not installed
   native-run  : not installed

System:

   NodeJS : v10.16.3 (/Users/neil/.nvm/versions/node/v10.16.3/bin/node)
   npm    : 6.13.6
   OS     : macOS Mojave

To reproduce
Steps to reproduce the behavior:

  1. Build mobile using cross-env REACT_APP_APPENV=development react-scripts build && ionic capacitor copy ios && ionic capacitor open ios
  2. Try to print env variable REACT_APP_APPENV using console.log(process.env)
  3. Result: {"NODE_ENV":"production","PUBLIC_URL":""}

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugIssues related to bugs on the documentation website

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions