Monday, April 9, 2018

How to configure pm2 with webpack for typescripts compile and reload?

Leave a Comment

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?

2 Answers

Answers 1

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\""   } 

Answers 2

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 Enjoyed This, Take 5 Seconds To Share It

0 comments:

Post a Comment