![[Node.js] Use "prestart" in scripts [Node.js] Use "prestart" in scripts](https://image.shishitao.com:8440/aHR0cHM6Ly9ia3FzaW1nLmlrYWZhbi5jb20vdXBsb2FkL2NoYXRncHQtcy5wbmc%2FIQ%3D%3D.png?!?w=700&webp=1)
Usually we run :
npm start
to start an app, then we we might call other script to do something:
npm build && nodemon app
Actaully we can use "prestart" to simpify this, because npm will check if there is "prestart" script, if there is it will run prestart before start:
"prestart": "babel src --out-dir dist",
"start": "node dist/index.js"