The tutorial gives examples of both a production- and a development way, but not combined. I'd like a single processes.json containing my apps, that supports running them in development with watch, babel-transpiler and cwd=src, where in production I'd like to enable logs and cwd=dist where the ES5 is located.
Am I taking a wrong approach here or is there a nice way to do this?
You may use a pre-processor that handles file transpilation + watch + restart. Then, use pm2 only for production.
Thing is, with an execution interpreter or a require hook, files won't be transpiled to new ES5 files, and therefore won't be able to use. In your case I'd add a Gulp process that:
Then to handle dist / src, use environment variables.
Thank you for taking the time to answer my question. Since pm2 supports transpilation, watching and restarting I've chosen to make a processes-dev.json and processes-prod.json, with a seperate build script that is run before processes-prod.json is read.
Most helpful comment
Thank you for taking the time to answer my question. Since pm2 supports transpilation, watching and restarting I've chosen to make a processes-dev.json and processes-prod.json, with a seperate build script that is run before processes-prod.json is read.