安装 npm install concurrently --save-dev
"concurrently": "^7.3.0",
concurrently支持开启多个服务,如下示例中执行npm run dev或者npm run all,则可以同时执行多个npm运行指令。
"scripts": {
"build": "vue-cli-service build",
"serve": "vue-cli-service serve",
"lint": "vue-cli-service lint",
"report": "vue-cli-service build --report",
"koa": "node ./koa/abs.js",
"dev": "concurrently \"npm run koa\" \"npm run serve\""
},
或
"scripts": {
"dev": "node app.js",
"start": "node index.js",
"all": "concurrently \"npm run dev\" \"npm start\""
},
支持多个打包程序服务一起进行的方式,使用&& 合并多个npm运行命令,执行 npm run build:all则得到lib-index和lib-login两个打包文件。
"scripts": {
"dev": "vue-cli-service serve",
"build": "vue-cli-service build",
"lib": "vue-cli-service build --target lib --name lib-index --dest lib-index ./src/index.js",
"lib:login": "vue-cli-service build --target lib --name lib-login --dest lib-login ./src/login.js",
"build:all": "npm run lib && npm run lib:login",
},
标签:npm,run,lib,多个,开启,service,build,cli
From: https://www.cnblogs.com/min77/p/16874470.html