Is there any boiler plate code to use pm2
with webpack
watch option for ts files auto hot reload?
pm2 start index.js
is helpful to run directly, but how to add multiple tasks before doing it like watch files and auto reload using webpack and pm2 from dist folders?
I am finally sticking with this after so much of research considering performance, i might add live reload which is todo task. But not a priority as of now.
scripts": {
"build": "webpack --config webpack.config.js --watch",
"pm2": "pm2 start ./dist/server.js --watch=true",
"postinstall": "npm run build",
"test": "jest --forceExit",
"test-ci": "npm test && cat ./coverage/lcov.info | coveralls",
"start": "supervisor ./dist/server.js",
"server:dev": "concurrently \"npm run build \" \"npm run start\""
}
Create a process.json for pm2 config In the script key you can give a webpack compiler to run. I am not sure if it will run for it watch reload.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With