Start both the front-end service and the back-end data service, and add & & node * *. Js, after dev in package.json, but it has no effect?

1. I use express to start the background service and combine mock.json to generate data. I want to start this data service at the same time as npm run dev, so I add & & node src/server/index.js after dev in package.json, but to no avail. Looking for answers?

"scripts": {
    "dev": "webpack-dev-server --inline --progress --config build/webpack.dev.conf.js && node src/server/index.js",
    "start": "npm run dev",
    "server": "node src/server/index.js",
    "lint": "eslint --ext .js,.vue src",
    "build": "node build/build.js"
  },
Jul.13,2021

problem solved: use'| 'instead of' & &'

"dev": "webpack-dev-server --inline --progress --config build/webpack.dev.conf.js | node src/server/index.js",

that's fine


webpack-dev-server is executed by Synchronize and runs until you finish manually. In other words, node src/server/index.js is not executed at all in your script.

Menu