Home > Software engineering >  How to run server only after webpack completes bundling bundles?
How to run server only after webpack completes bundling bundles?

Time:01-31

"scripts": {
    "start": "node server.js",
    "build": "webpack"
  },

how to run npm run build first and then npm start in a single command?

"scripts": {
    "start": "node server.js",
    "build": "webpack",
    "start-dev" : "npm run build && npm run start"
   },

I tried the command npm run start-dev. But only webpack is being compiled. The server isn't running.

CodePudding user response:

I don't know why that doesn't work, but, anyway, you can try this:

"scripts": {
    "start": "node server.js",
    "build": "webpack",
    "start-dev" : "webpack && node server.js"
}

CodePudding user response:

      npm i npm-run-all

this package never run into issue. You can add as many as commands

   "dev:start": "npm-run-all build start",
  •  Tags:  
  • Related