Can we use pm2 to start the development server of Vue cli? Can we use pm2 to start the development server of Vue cli? vue.js vue.js

Can we use pm2 to start the development server of Vue cli?


My solution

First, deleted all running pm2 instances

pm2 delete all

Then entered this configuration as ecosystem.js

module.exports = {  apps: [    {      name: "WEB",      script: "./node_modules/@vue/cli-service/bin/vue-cli-service.js",      args: "serve"    }  ]};

Note: vue server is already setup natively to do watching and reloading so do not add watch to pm2 settings otherwise the full dev server will be restarted, instead of doing the plain hot reload of vue-cli-service

Also: I suggest to install pm2-logrotate

Then restarted

pm2 start ecosystem.js

To follow logs simply use

pm2 logs

eventually adding the app name as argument to see only one log

Use case

I'm using this to work on a local smtp-catcher server and a webapp to read the catched email


Yes you can. pm2 start "npm run serve" --name <app name here>