Home > Enterprise >  What is the difference between npm prestart and npm poststart?
What is the difference between npm prestart and npm poststart?

Time:12-24

I am familiar with npm start, but I don't know what does the prestart and poststart do exactly. Which script is runned before start (i.e.: pre or post). I wanna know to proper flow of it...?

After doing some research I found prestart is called first than start is called.

CodePudding user response:

When we set up our scripts properly then simply running the command npm start will be able to handle all of our needs in the proper order. It's has huge useful for many situations where we need something to happen immediately before or immediately after a primary action.( npm start) Here You have reference.

Example

{
  "scripts": {
    "prestart": "node first.js",
    "start": "node index.js",
    "poststart": "node last.js"
  }
}

prestart starts first before npm start and poststart is fired last.

  • Related