简体   繁体   中英

What is the difference between npm prestart and npm poststart?

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 (ie: 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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM