2
pm2 start --node-args="-r dotenv/config" node_modules/react-scripts/bin/react-scripts.js --name app -- start dotenv_config_path=.env.$NODE_ENV

this script works

i want this one to work as well:

pm2 start ecosystem.json --env env_development

where the dotenv_config_path is inside the env variables inside the ecosystem file.

tried adding the dotenv_config_path inside the env variables and setting the env variables using --env env_development

1 Answers1

0

Try adding node_args to your ecosystem file. For example:

{
    "apps": [{
        "name": "development",
        "script": "./src/bin/index.js",
        "node_args": '-r dotenv/config dotenv_config_path=.env.dev',
    }]
}

That might work for you.

Vasilis
  • 121
  • 3