如何使用webpack配置pm2 for typescripts编译和重新加载?

Mit*_*tsa 6 javascript express typescript pm2 webpack

对于ts​​文件自动热重载,是否有pm2webpackwatch选项一起使用的样板代码?

pm2 start index.js 有助于直接运行,但如何在执行之前添加多个任务,如监视文件和使用webpack和pm2从dist文件夹自动重新加载?

Mit*_*tsa 6

在考虑了性能的大量研究之后,我终于坚持这一点,我可能会添加实时重载,这是任务.但不是现在的优先事项.

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\""
  }
Run Code Online (Sandbox Code Playgroud)