There is a certain Node.js script prod.js that runs the dev server on a specific port.
const { execSync } = require('child_process') process.env.NODE_ENV = 'production' const WEBPACK_PATH = 'node_modules/.bin/webpack' const WEBPACK_CONFIG_PATH = 'internals/webpack/configs/prod' execSync('yarn install --production=false') execSync('rm -rf ./build') execSync(`"${WEBPACK_PATH}" --config "${WEBPACK_CONFIG_PATH}"/webpack.prod.client.babel.js --display-error-details`) execSync(`"${WEBPACK_PATH}" --config "${WEBPACK_CONFIG_PATH}"/webpack.prod.server.babel.js --display-error-details`) execSync('node ./scripts/server/start-server.babel.js') Is it possible to demonize him? That he do the following
- started with a physical restart of the machine (very necessary)
- reacted to file changes
- nailed the process at the specified port
I found a couple of modules: pm2 and nodemon , however, I do not see their ability to auto-start at system startup.
Also tried nodemon , however, the command
nodemon ./prod.js Falls into a permanent reboot, therefore, the process can not even start
[nodemon] restarting due to changes... [nodemon] starting `node scripts/prod.js` [nodemon] restarting due to changes... [nodemon] restarting due to changes... [nodemon] restarting due to changes... [nodemon] restarting due to changes... [nodemon] restarting due to changes... [nodemon] restarting due to changes... [nodemon] starting `node scripts/prod.js` [nodemon] restarting due to changes... [nodemon] restarting due to changes... [nodemon] restarting due to changes... Who faced a similar task, tell me, please?
nodemondiffer fromfs.watch()? - Beast Winterwolf