I believe the title speaks for itself, but let's dive in:
What advantages does using the pre-script of npm package.json
, like prestart
, have over simply combining commands with &&
in the start
script?
{
prestart: "parcel build",
start "nodemon server.js"
}
compared to
{
start: "parcel build && nodemon server.js"
}
Is it more suitable for different platforms?
Can it handle running two asynchronous endless processes, such as two servers (build + api)?
Any other benefits?
Edit:
I found a benefit for postInstall
. Platforms like Heroku remove devDependency
after running npm install
, so in the postinstall
I can execute the build
process before Heroku removes the necessary code.